<!doctype html>
<html>
<head>
<meta charset='UTF-8'><meta name='viewport' content='width=device-width initial-scale=1'>
<title>电子发票Open API文档</title><link href='https://fonts.loli.net/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext' rel='stylesheet' type='text/css' /><style type='text/css'>html {overflow-x: initial !important;}#write, body { height: auto; }
#write, #write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write ol, #write p, #write ul { position: relative; }
#write, #write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p, #write pre { width: inherit; }
h1, h2, h3, h4, h5, h6, tr { break-inside: avoid; }
#write, pre { white-space: pre-wrap; }
.CodeMirror, .md-fences, table { text-align: left; }
.md-reset, a:active, a:hover { outline: 0px; }
.md-reset, .md-toc-item a { text-decoration: none; }
.MathJax_SVG, .md-reset { float: none; direction: ltr; }
:root { --bg-color:#ffffff; --text-color:#333333; }
html { font-size: 14px; background-color: var(--bg-color); color: var(--text-color); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
body { margin: 0px; padding: 0px; bottom: 0px; top: 0px; left: 0px; right: 0px; font-size: 1rem; line-height: 1.42857; overflow-x: hidden; background: inherit; }
a.url { word-break: break-all; }
.in-text-selection, ::selection { background: rgb(181, 214, 252); text-shadow: none; }
#write { margin: 0px auto; word-break: normal; word-wrap: break-word; padding-bottom: 70px; overflow-x: visible; }
.first-line-indent #write p .md-line { text-indent: 0px; }
.first-line-indent #write li, .first-line-indent #write p, .first-line-indent #write p .md-line:first-child { text-indent: 2em; }
.for-image #write { padding-left: 8px; padding-right: 8px; }
body.typora-export { padding-left: 30px; padding-right: 30px; }
@media screen and (max-width: 500px) {
  body.typora-export { padding-left: 0px; padding-right: 0px; }
  .CodeMirror-sizer { margin-left: 0px !important; }
  .CodeMirror-gutters { display: none !important; }
}
#write > blockquote:first-child, #write > div:first-child, #write > ol:first-child, #write > p:first-child, #write > pre:first-child, #write > table:first-child, #write > ul:first-child { margin-top: 30px; }
#write li > table:first-child { margin-top: -20px; }
img { max-width: 100%; vertical-align: middle; }
button, input, select, textarea { color: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; }
input[type="checkbox"], input[type="radio"] { line-height: normal; padding: 0px; }
*, ::after, ::before { box-sizing: border-box; }
h1, h2, h3, h4, h5, h6 { break-after: avoid-page; orphans: 2; }
p { orphans: 4; -webkit-margin-before: 1rem; -webkit-margin-after: 1rem; -webkit-margin-start: 0px; -webkit-margin-end: 0px; }
h1 { font-size: 2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.6rem; }
h4 { font-size: 1.4rem; }
h5 { font-size: 1.2rem; }
h6 { font-size: 1rem; }
.mathjax-block { margin-top: 0px; margin-bottom: 0px; -webkit-margin-before: 0px; -webkit-margin-after: 0px; }
.hidden { display: none; }
.md-blockmeta { color: rgb(204, 204, 204); font-weight: 700; font-style: italic; }
a { cursor: pointer; }
sup.md-footnote { padding: 2px 4px; background-color: rgba(238, 238, 238, 0.7); color: rgb(85, 85, 85); border-radius: 4px; }
#write input[type="checkbox"] { cursor: pointer; width: inherit; height: inherit; }
#write > figure:first-child { margin-top: 2em; }
figure { overflow-x: auto; margin: 1.2em 0px 0px; max-width: calc(100% + 16px); padding: 0px; }
figure > table { margin: 0px !important; }
tr { break-after: auto; }
thead { display: table-header-group; }
table { border-collapse: collapse; border-spacing: 0px; width: 100%; overflow: auto; break-inside: auto; }
.CodeMirror-line, .md-fences { break-inside: avoid; }
table.md-table td { min-width: 80px; }
.CodeMirror-gutters { border-right: 0px; background-color: inherit; margin-right: 4px; }
.CodeMirror-placeholder { opacity: 0.3; }
.CodeMirror pre { padding: 0px 4px; }
.CodeMirror-lines { padding: 0px; }
div.hr:focus { cursor: none; }
.md-fences { font-size: 0.9rem; display: block; overflow: visible; white-space: pre; background: inherit; position: relative !important; }
.md-diagram-panel { width: 100%; margin-top: 10px; text-align: center; padding-top: 0px; padding-bottom: 8px; overflow-x: auto; }
.md-fences .CodeMirror.CodeMirror-wrap { top: -1.6em; margin-bottom: -1.6em; }
.md-fences.mock-cm { white-space: pre-wrap; }
.show-fences-line-number .md-fences { padding-left: 0px; }
.show-fences-line-number .md-fences.mock-cm { padding-left: 40px; }
.footnotes { opacity: 0.8; font-size: 0.9rem; margin-top: 1em; margin-bottom: 1em; }
.footnotes + .footnotes { margin-top: 0px; }
.md-reset { margin: 0px; padding: 0px; border: 0px; vertical-align: top; background: 0px 0px; text-shadow: none; position: static; width: auto; height: auto; white-space: nowrap; cursor: inherit; -webkit-tap-highlight-color: transparent; line-height: normal; font-weight: 400; text-align: left; box-sizing: content-box; }
.md-toc-inner, a img, img a { cursor: pointer; }
li div { padding-top: 0px; }
blockquote { margin: 1rem 0px; }
li .mathjax-block, li p { margin: 0.5rem 0px; }
li { margin: 0px; position: relative; }
blockquote > :last-child { margin-bottom: 0px; }
blockquote > :first-child { margin-top: 0px; }
.footnotes-area { color: rgb(136, 136, 136); margin-top: 0.714rem; padding-bottom: 0.143rem; white-space: normal; }
@media print {
  body, html { border: 1px solid transparent; height: 99%; break-after: avoid; break-before: avoid; }
  #write { margin-top: 0px; border-color: transparent !important; }
  .typora-export * { -webkit-print-color-adjust: exact; }
  html.blink-to-pdf { font-size: 13px; }
  .typora-export #write { padding-left: 1cm; padding-right: 1cm; padding-bottom: 0px; break-after: avoid; }
  .typora-export #write::after { height: 0px; }
  @page { margin: 20mm 0px; }
}
.footnote-line { white-space: pre-wrap; margin-top: 0.714em; font-size: 0.7em; }
pre.md-meta-block { font-size: 0.8rem; min-height: 0.8rem; white-space: pre-wrap; background: rgb(204, 204, 204); display: block; overflow-x: hidden; }
p > img:only-child { display: block; margin: auto; }
.md-line > .md-image:only-child, p > .md-image:only-child { display: inline-block; width: 100%; text-align: center; }
.mathjax-block:not(:empty)::after, .md-toc-content::after, .md-toc::after { display: none; }
#write .MathJax_Display { margin: 0.8em 0px 0px; }
.mathjax-block { white-space: pre; overflow: hidden; width: 100%; }
p + .mathjax-block { margin-top: -1.143rem; }
[contenteditable="true"]:active, [contenteditable="true"]:focus { outline: 0px; box-shadow: none; }
.md-task-list-item { position: relative; list-style-type: none; }
.task-list-item.md-task-list-item { padding-left: 0px; }
.md-task-list-item > input { position: absolute; top: 0px; left: 0px; margin-left: -1.2em; margin-top: calc(1em - 10px); }
.math { font-size: 1rem; }
.md-toc { min-height: 3.58rem; position: relative; font-size: 0.9rem; border-radius: 10px; }
.MathJax_SVG, .mathjax-block .MathJax_SVG_Display { text-indent: 0px; max-width: none; max-height: none; min-height: 0px; }
.md-toc-content { position: relative; margin-left: 0px; }
.md-toc-item { display: block; color: rgb(65, 131, 196); }
.md-toc-inner:hover { }
.md-toc-inner { display: inline-block; }
.md-toc-h1 .md-toc-inner { margin-left: 0px; font-weight: 700; }
.md-toc-h2 .md-toc-inner { margin-left: 2em; }
.md-toc-h3 .md-toc-inner { margin-left: 4em; }
.md-toc-h4 .md-toc-inner { margin-left: 6em; }
.md-toc-h5 .md-toc-inner { margin-left: 8em; }
.md-toc-h6 .md-toc-inner { margin-left: 10em; }
@media screen and (max-width: 48em) {
  .md-toc-h3 .md-toc-inner { margin-left: 3.5em; }
  .md-toc-h4 .md-toc-inner { margin-left: 5em; }
  .md-toc-h5 .md-toc-inner { margin-left: 6.5em; }
  .md-toc-h6 .md-toc-inner { margin-left: 8em; }
}
a.md-toc-inner { font-size: inherit; font-style: inherit; font-weight: inherit; line-height: inherit; }
.footnote-line a:not(.reversefootnote) { color: inherit; }
.md-attr { display: none; }
.md-fn-count::after { content: "."; }
code, pre, tt { font-family: var(--monospace); }
.md-comment { color: rgb(162, 127, 3); opacity: 0.8; font-family: var(--monospace); }
code { text-align: left; }
a.md-print-anchor { border-width: initial !important; border-style: none !important; border-color: initial !important; display: inline-block !important; position: absolute !important; width: 1px !important; right: 0px !important; outline: 0px !important; background: 0px 0px !important; text-decoration: initial !important; text-shadow: initial !important; }
.md-inline-math .MathJax_SVG .noError { display: none !important; }
.mathjax-block .MathJax_SVG_Display { text-align: center; margin: 1em 0px; position: relative; min-width: 100%; width: auto; display: block !important; }
.MathJax_SVG_Display, .md-inline-math .MathJax_SVG_Display { width: auto; margin: inherit; display: inline-block !important; }
.MathJax_SVG .MJX-monospace { font-family: monospace; }
.MathJax_SVG .MJX-sans-serif { font-family: sans-serif; }
.MathJax_SVG { display: inline; font-style: normal; font-weight: 400; line-height: normal; zoom: 90%; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; min-width: 0px; border: 0px; padding: 0px; margin: 0px; }
.MathJax_SVG * { transition: none; }
.os-windows.monocolor-emoji .md-emoji { font-family: "Segoe UI Symbol", sans-serif; }
.md-diagram-panel > svg, [lang="flow"] svg, [lang="mermaid"] svg { max-width: 100%; }
[lang="mermaid"] .node text { font-size: 1rem; }
table tr th { border-bottom: 0px; }


.CodeMirror, .CodeMirror-sizer { position: relative; }
.CodeMirror.cm-s-inner { background: inherit; }
.fences-no-line-wrapping .md-fences .CodeMirror { margin-top: -20px; }
.CodeMirror-scroll { overflow-y: hidden; overflow-x: auto; }
.CodeMirror-lines { padding: 4px 0px; }
.CodeMirror-gutter-filler, .CodeMirror-scrollbar-filler { background-color: rgb(255, 255, 255); }
.CodeMirror-scroll, .cm-s-inner .CodeMirror-activeline-background { background: inherit; }
.CodeMirror-linenumber { padding: 0px 3px 0px 5px; text-align: right; color: rgb(153, 153, 153); }
.cm-s-inner .cm-keyword { color: rgb(119, 0, 136); }
.cm-s-inner .cm-atom, .cm-s-inner.cm-atom { color: rgb(34, 17, 153); }
.cm-s-inner .cm-number { color: rgb(17, 102, 68); }
.cm-s-inner .cm-def { color: rgb(0, 0, 255); }
.cm-s-inner .cm-variable { color: rgb(0, 0, 0); }
.cm-s-inner .cm-variable-2 { color: rgb(0, 85, 170); }
.cm-s-inner .cm-variable-3 { color: rgb(0, 136, 85); }
.cm-s-inner .cm-string { color: rgb(170, 17, 17); }
.cm-s-inner .cm-property { color: rgb(0, 0, 0); }
.cm-s-inner .cm-operator { color: rgb(152, 26, 26); }
.cm-s-inner .cm-comment, .cm-s-inner.cm-comment { color: rgb(170, 85, 0); }
.cm-s-inner .cm-string-2 { color: rgb(255, 85, 0); }
.cm-s-inner .cm-meta, .cm-s-inner .cm-qualifier { color: rgb(85, 85, 85); }
.cm-s-inner .cm-builtin { color: rgb(51, 0, 170); }
.cm-s-inner .cm-bracket { color: rgb(153, 153, 119); }
.cm-s-inner .cm-tag { color: rgb(17, 119, 0); }
.cm-s-inner .cm-attribute { color: rgb(0, 0, 204); }
.cm-s-inner .cm-header, .cm-s-inner.cm-header { color: rgb(0, 0, 255); }
.cm-s-inner .cm-quote, .cm-s-inner.cm-quote { color: rgb(0, 153, 0); }
.cm-s-inner .cm-hr, .cm-s-inner.cm-hr { color: rgb(153, 153, 153); }
.cm-s-inner .cm-link, .cm-s-inner.cm-link { color: rgb(0, 0, 204); }
.cm-negative { color: rgb(221, 68, 68); }
.cm-positive { color: rgb(34, 153, 34); }
.cm-header, .cm-strong { font-weight: 700; }
.cm-del { text-decoration: line-through; }
.cm-em { font-style: italic; }
.cm-link { text-decoration: underline; }
.cm-error, .cm-invalidchar { color: red; }
.cm-constant { color: rgb(38, 139, 210); }
.cm-defined { color: rgb(181, 137, 0); }
div.CodeMirror span.CodeMirror-matchingbracket { color: rgb(0, 255, 0); }
div.CodeMirror span.CodeMirror-nonmatchingbracket { color: rgb(255, 34, 34); }
.CodeMirror { height: auto; overflow: hidden; }
.CodeMirror-scroll { margin-bottom: -30px; padding-bottom: 30px; height: 100%; outline: 0px; position: relative; box-sizing: content-box; }
.CodeMirror-gutter-filler, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-vscrollbar { position: absolute; z-index: 6; display: none; }
.CodeMirror-vscrollbar { right: 0px; top: 0px; overflow-x: hidden; overflow-y: scroll; }
.CodeMirror-hscrollbar { bottom: 0px; left: 0px; overflow-y: hidden; overflow-x: scroll; }
.CodeMirror-scrollbar-filler { right: 0px; bottom: 0px; }
.CodeMirror-gutter-filler { left: 0px; bottom: 0px; }
.CodeMirror-gutters { border-right: 1px solid rgb(221, 221, 221); background: inherit; white-space: nowrap; position: absolute; left: 0px; top: 0px; padding-bottom: 30px; z-index: 3; }
.CodeMirror-gutter { white-space: normal; height: 100%; box-sizing: content-box; padding-bottom: 30px; margin-bottom: -32px; display: inline-block; }
.CodeMirror-gutter-wrapper { position: absolute; z-index: 4; background: 0px 0px !important; border: none !important; }
.CodeMirror-gutter-background { position: absolute; top: 0px; bottom: 0px; z-index: 4; }
.CodeMirror-gutter-elt { position: absolute; cursor: default; z-index: 4; }
.CodeMirror-lines { cursor: text; }
.CodeMirror pre { border-radius: 0px; border-width: 0px; background: 0px 0px; font-family: inherit; font-size: inherit; margin: 0px; white-space: pre; word-wrap: normal; color: inherit; z-index: 2; position: relative; overflow: visible; }
.CodeMirror-wrap pre { word-wrap: break-word; white-space: pre-wrap; word-break: normal; }
.CodeMirror-code pre { border-right: 30px solid transparent; width: fit-content; }
.CodeMirror-wrap .CodeMirror-code pre { border-right: none; width: auto; }
.CodeMirror-linebackground { position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: 0; }
.CodeMirror-linewidget { position: relative; z-index: 2; overflow: auto; }
.CodeMirror-wrap .CodeMirror-scroll { overflow-x: hidden; }
.CodeMirror-measure { position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden; }
.CodeMirror-measure pre { position: static; }
.CodeMirror div.CodeMirror-cursor { position: absolute; border-right: none; width: 0px; visibility: hidden; }
.CodeMirror-focused div.CodeMirror-cursor { visibility: inherit; }
.CodeMirror-selected { background: rgb(217, 217, 217); }
.CodeMirror-focused .CodeMirror-selected { background: rgb(215, 212, 240); }
.cm-searching { background: rgba(255, 255, 0, 0.4); }
@media print {
  .CodeMirror div.CodeMirror-cursor { visibility: hidden; }
}
.CodeMirror-lint-markers { width: 16px; }
.CodeMirror-lint-tooltip { background-color: infobackground; border: 1px solid rgb(0, 0, 0); border-radius: 4px; color: infotext; font-family: var(--monospace); overflow: hidden; padding: 2px 5px; position: fixed; white-space: pre-wrap; z-index: 10000; max-width: 600px; opacity: 0; transition: opacity 0.4s; font-size: 0.8em; }
.CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning { background-position: left bottom; background-repeat: repeat-x; }
.CodeMirror-lint-mark-error { background-image: url(""); }
.CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning { background-position: center center; background-repeat: no-repeat; cursor: pointer; display: inline-block; height: 16px; width: 16px; vertical-align: middle; position: relative; }
.CodeMirror-lint-message-error, .CodeMirror-lint-message-warning { padding-left: 18px; background-position: left top; background-repeat: no-repeat; }
.CodeMirror-lint-marker-error, .CodeMirror-lint-message-error { background-image: url(""); }
.CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning { background-image: url(""); }
.CodeMirror-lint-marker-multiple { background-image: url(""); background-repeat: no-repeat; background-position: right bottom; width: 100%; height: 100%; }


:root { --side-bar-bg-color: #fafafa; --control-text-color: #777; }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: normal; src: local("Open Sans Regular"), url("./github/400.woff") format("woff"); }
@font-face { font-family: "Open Sans"; font-style: italic; font-weight: normal; src: local("Open Sans Italic"), url("./github/400i.woff") format("woff"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: bold; src: local("Open Sans Bold"), url("./github/700.woff") format("woff"); }
@font-face { font-family: "Open Sans"; font-style: italic; font-weight: bold; src: local("Open Sans Bold Italic"), url("./github/700i.woff") format("woff"); }
html { font-size: 16px; }
body { font-family: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; color: rgb(51, 51, 51); line-height: 1.6; }
#write { max-width: 860px; margin: 0px auto; padding: 30px 30px 100px; }
#write > ul:first-child, #write > ol:first-child { margin-top: 30px; }
a { color: rgb(65, 131, 196); }
h1, h2, h3, h4, h5, h6 { position: relative; margin-top: 1rem; margin-bottom: 1rem; font-weight: bold; line-height: 1.4; cursor: text; }
h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor { text-decoration: none; }
h1 tt, h1 code { font-size: inherit; }
h2 tt, h2 code { font-size: inherit; }
h3 tt, h3 code { font-size: inherit; }
h4 tt, h4 code { font-size: inherit; }
h5 tt, h5 code { font-size: inherit; }
h6 tt, h6 code { font-size: inherit; }
h1 { padding-bottom: 0.3em; font-size: 2.25em; line-height: 1.2; border-bottom: 1px solid rgb(238, 238, 238); }
h2 { padding-bottom: 0.3em; font-size: 1.75em; line-height: 1.225; border-bottom: 1px solid rgb(238, 238, 238); }
h3 { font-size: 1.5em; line-height: 1.43; }
h4 { font-size: 1.25em; }
h5 { font-size: 1em; }
h6 { font-size: 1em; color: rgb(119, 119, 119); }
p, blockquote, ul, ol, dl, table { margin: 0.8em 0px; }
li > ol, li > ul { margin: 0px; }
hr { height: 2px; padding: 0px; margin: 16px 0px; background-color: rgb(231, 231, 231); border: 0px none; overflow: hidden; box-sizing: content-box; }
li p.first { display: inline-block; }
ul, ol { padding-left: 30px; }
ul:first-child, ol:first-child { margin-top: 0px; }
ul:last-child, ol:last-child { margin-bottom: 0px; }
blockquote { border-left: 4px solid rgb(223, 226, 229); padding: 0px 15px; color: rgb(119, 119, 119); }
blockquote blockquote { padding-right: 0px; }
table { padding: 0px; word-break: initial; }
table tr { border-top: 1px solid rgb(223, 226, 229); margin: 0px; padding: 0px; }
table tr:nth-child(2n), thead { background-color: rgb(248, 248, 248); }
table tr th { font-weight: bold; border-width: 1px 1px 0px; border-top-style: solid; border-right-style: solid; border-left-style: solid; border-top-color: rgb(223, 226, 229); border-right-color: rgb(223, 226, 229); border-left-color: rgb(223, 226, 229); border-image: initial; border-bottom-style: initial; border-bottom-color: initial; text-align: left; margin: 0px; padding: 6px 13px; }
table tr td { border: 1px solid rgb(223, 226, 229); text-align: left; margin: 0px; padding: 6px 13px; }
table tr th:first-child, table tr td:first-child { margin-top: 0px; }
table tr th:last-child, table tr td:last-child { margin-bottom: 0px; }
.CodeMirror-lines { padding-left: 4px; }
.code-tooltip { box-shadow: rgba(0, 28, 36, 0.3) 0px 1px 1px 0px; border-top: 1px solid rgb(238, 242, 242); }
.md-fences, code, tt { border: 1px solid rgb(231, 234, 237); background-color: rgb(248, 248, 248); border-radius: 3px; padding: 2px 4px 0px; font-size: 0.9em; }
code { background-color: rgb(243, 244, 244); padding: 0px 2px; }
.md-fences { margin-bottom: 15px; margin-top: 15px; padding-top: 8px; padding-bottom: 6px; }
.md-task-list-item > input { margin-left: -1.3em; }
@media print {
  html { font-size: 13px; }
  table, pre { break-inside: avoid; }
  pre { word-wrap: break-word; }
}
.md-fences { background-color: rgb(248, 248, 248); }
#write pre.md-meta-block { padding: 1rem; font-size: 85%; line-height: 1.45; background-color: rgb(247, 247, 247); border: 0px; border-radius: 3px; color: rgb(119, 119, 119); margin-top: 0px !important; }
.mathjax-block > .code-tooltip { bottom: 0.375rem; }
.md-mathjax-midline { background: rgb(250, 250, 250); }
#write > h3.md-focus::before { left: -1.5625rem; top: 0.375rem; }
#write > h4.md-focus::before { left: -1.5625rem; top: 0.285714rem; }
#write > h5.md-focus::before { left: -1.5625rem; top: 0.285714rem; }
#write > h6.md-focus::before { left: -1.5625rem; top: 0.285714rem; }
.md-image > .md-meta { border-radius: 3px; padding: 2px 0px 0px 4px; font-size: 0.9em; color: inherit; }
.md-tag { color: rgb(167, 167, 167); opacity: 1; }
.md-toc { margin-top: 20px; padding-bottom: 20px; }
.sidebar-tabs { border-bottom: none; }
#typora-quick-open { border: 1px solid rgb(221, 221, 221); background-color: rgb(248, 248, 248); }
#typora-quick-open-item { background-color: rgb(250, 250, 250); border-color: rgb(254, 254, 254) rgb(229, 229, 229) rgb(229, 229, 229) rgb(238, 238, 238); border-style: solid; border-width: 1px; }
.on-focus-mode blockquote { border-left-color: rgba(85, 85, 85, 0.12); }
header, .context-menu, .megamenu-content, footer { font-family: "Segoe UI", Arial, sans-serif; }
.file-node-content:hover .file-node-icon, .file-node-content:hover .file-node-open-state { visibility: visible; }
.mac-seamless-mode #typora-sidebar { background-color: var(--side-bar-bg-color); }
.md-lang { color: rgb(180, 101, 77); }
.html-for-mac .context-menu { --item-hover-bg-color: #E6F0FE; }
#md-notification .btn { border: 0px; }
.dropdown-menu .divider { border-color: rgb(229, 229, 229); }





 .typora-export p, .typora-export .footnote-line {white-space: normal;} 
</style>
</head>
<body class='typora-export os-windows' >
<div  id='write'  class = 'is-node'><h1><a name='header-n0' class='md-header-anchor '></a>电子发票开票Open API文档</h1><blockquote><p><strong>修改历史</strong></p><figure><table><thead><tr><th style='text-align:left;' >版本号</th><th style='text-align:left;' >变更日期</th><th style='text-align:left;' >变更内容</th><th style='text-align:center;' >变更人</th><th style='text-align:center;' >批准</th></tr></thead><tbody><tr><td style='text-align:left;' >V0.01</td><td style='text-align:left;' >2016-05-03</td><td style='text-align:left;' >创建</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V0.02</td><td style='text-align:left;' >2016-05-05</td><td style='text-align:left;' >1、请求url变更</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V0.03</td><td style='text-align:left;' >2016-05-06</td><td style='text-align:left;' >1、修改字段的是否必输<br>2、发票明细增加项目价税合计</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V0.03</td><td style='text-align:left;' >2016-05-09</td><td style='text-align:left;' >1、增加回调服务post参数说明</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V0.04</td><td style='text-align:left;' >2016-05-12</td><td style='text-align:left;' >1、回调服务参数增加发票明细与发票的关系说明</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V0.05</td><td style='text-align:left;' >2016-05-19</td><td style='text-align:left;' >1、发票明细增加行号</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V0.06</td><td style='text-align:left;' >2016-06-06</td><td style='text-align:left;' >1、增加开票状态查询服务</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V0.07</td><td style='text-align:left;' >2016-06-16</td><td style='text-align:left;' >1、增加参数，支持开票请求自动审核</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V0.08</td><td style='text-align:left;' >2016-07-08</td><td style='text-align:left;' >1、支持开具红票</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.00</td><td style='text-align:left;' >2016-07-22</td><td style='text-align:left;' >1、适配增值税发票税控开票软件数据接口规范V3.0<br>2、开票接口增加字段BMB_BBH、SPBM、ZXBM、YHZCBS、LSLBS、ZZSTSGL<br>3、对应税控软件版本V2.1.20.160425.01</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.01</td><td style='text-align:left;' >2016-08-08</td><td style='text-align:left;' >1、调整api字段，避免误解<br>2、增加开票组织参数</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.02</td><td style='text-align:left;' >2016-09-05</td><td style='text-align:left;' >1、增加明细折扣行处理<br>2、发票请求样例补充<br>3、增加签名说明<br>4、增加java调用样例</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.03</td><td style='text-align:left;' >2016-09-27</td><td style='text-align:left;' >1、增加发票类型字段定义</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.04</td><td style='text-align:left;' >2016-10-08</td><td style='text-align:left;' >1、增加C#样例代码</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.05</td><td style='text-align:left;' >2016-10-08</td><td style='text-align:left;' >1、修改部分url参数大小写问题</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.06</td><td style='text-align:left;' >2016-11-14</td><td style='text-align:left;' >1、修改回调参数样例</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.07</td><td style='text-align:left;' >2016-12-24</td><td style='text-align:left;' >1、接口支持差额征税</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.08</td><td style='text-align:left;' >2017-01-05</td><td style='text-align:left;' >1、增加开票申请进行开票接口</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.09</td><td style='text-align:left;' >2017-02-10</td><td style='text-align:left;' >1、修改java样例的证书读取</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.10</td><td style='text-align:left;' >2017-03-07</td><td style='text-align:left;' >1、修改文档开票url错误</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.11</td><td style='text-align:left;' >2017-03-12</td><td style='text-align:left;' >1、开票接口增加微信订单参数<BR>2、红冲接口支持传入开票人、复核人、收款人</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.12</td><td style='text-align:left;' >2017-03-18</td><td style='text-align:left;' >1、开票接口增加微信商户appid，与微信订单id一起支持发票插入微信卡包</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.13</td><td style='text-align:left;' >2017-05-08</td><td style='text-align:left;' >1、修改C#样例，解决URLEncode问题</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.14</td><td style='text-align:left;' >2017-08-15</td><td style='text-align:left;' >1、表体商品自行编码、数量改为不必输</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.15</td><td style='text-align:left;' >2017-08-18</td><td style='text-align:left;' >1、删除样例代码中pem格式证书的读取代码</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.16</td><td style='text-align:left;' >2017-09-01</td><td style='text-align:left;' >增加部分红冲接口</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.17</td><td style='text-align:left;' >2018-03-23</td><td style='text-align:left;' >1、支持成品油开具<BR>2、销售方名称修改为非必输<BR>3、完善ORGCODE描述<BR>4、增加PHP示例代码 <BR>5、修改默认过期时间</td><td style='text-align:center;' >梁吉明</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.18</td><td style='text-align:left;' >2018-05-28</td><td style='text-align:left;' >1、完善了样例代码（避免了有些情况下出现的证书不受信任的情况和linux环境下样例代码报空指针的问题）<BR>2、添加了JDK1.5的样例代码<BR>3、完善了PHP样例代码</td><td style='text-align:center;' >邢国庆</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.19</td><td style='text-align:left;' >2018-06-08</td><td style='text-align:left;' >增加成品油卷式发票类型</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.20</td><td style='text-align:left;' >2018-06-15</td><td style='text-align:left;' >增加成品油普通发票、成品油专票、普通卷式发票类型</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.21</td><td style='text-align:left;' >2018-06-25</td><td style='text-align:left;' >适配微信批量插卡包授权</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.22</td><td style='text-align:left;' >2018-08-06</td><td style='text-align:left;' >支持电子农产品收购发票</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.23</td><td style='text-align:left;' >2018-10-09</td><td style='text-align:left;' >查询开票状态接口增加zdybz返回值说明</td><td style='text-align:center;' >孙伟</td><td style='text-align:center;' >&nbsp;</td></tr><tr><td style='text-align:left;' >V1.24</td><td style='text-align:left;' >2018-10-15</td><td style='text-align:left;' >增加商品编码字段</td><td style='text-align:center;' >王伟</td><td style='text-align:center;' >&nbsp;</td></tr></tbody></table></figure></blockquote><div class='md-toc' mdtype='toc'><p class="md-toc-content"><span class="md-toc-item md-toc-h1" data-ref="n0"><a class="md-toc-inner" href="#header-n0">电子发票开票Open API文档</a></span><span class="md-toc-item md-toc-h2" data-ref="n218"><a class="md-toc-inner" href="#header-n218">1、开票蓝票请求服务</a></span><span class="md-toc-item md-toc-h3" data-ref="n219"><a class="md-toc-inner" href="#header-n219">请求说明</a></span><span class="md-toc-item md-toc-h3" data-ref="n228"><a class="md-toc-inner" href="#header-n228">请求头参数</a></span><span class="md-toc-item md-toc-h3" data-ref="n252"><a class="md-toc-inner" href="#header-n252">请求体参数</a></span><span class="md-toc-item md-toc-h4" data-ref="n253"><a class="md-toc-inner" href="#header-n253">表单说明</a></span><span class="md-toc-item md-toc-h4" data-ref="n285"><a class="md-toc-inner" href="#header-n285">发票头</a></span><span class="md-toc-item md-toc-h4" data-ref="n497"><a class="md-toc-inner" href="#header-n497">发票明细</a></span><span class="md-toc-item md-toc-h4" data-ref="n662"><a class="md-toc-inner" href="#header-n662">邮件推送配置</a></span><span class="md-toc-item md-toc-h4" data-ref="n664"><a class="md-toc-inner" href="#header-n664">短信推送配置</a></span><span class="md-toc-item md-toc-h4" data-ref="n691"><a class="md-toc-inner" href="#header-n691">回调服务配置</a></span><span class="md-toc-item md-toc-h4" data-ref="n760"><a class="md-toc-inner" href="#header-n760">请求样例</a></span><span class="md-toc-item md-toc-h3" data-ref="n782"><a class="md-toc-inner" href="#header-n782">返回结果说明</a></span><span class="md-toc-item md-toc-h4" data-ref="n801"><a class="md-toc-inner" href="#header-n801">返回样例</a></span><span class="md-toc-item md-toc-h2" data-ref="n804"><a class="md-toc-inner" href="#header-n804">2、开票蓝票请求服务--发票拆分</a></span><span class="md-toc-item md-toc-h3" data-ref="n805"><a class="md-toc-inner" href="#header-n805">请求说明</a></span><span class="md-toc-item md-toc-h3" data-ref="n814"><a class="md-toc-inner" href="#header-n814">请求头参数</a></span><span class="md-toc-item md-toc-h3" data-ref="n838"><a class="md-toc-inner" href="#header-n838">请求体参数</a></span><span class="md-toc-item md-toc-h4" data-ref="n839"><a class="md-toc-inner" href="#header-n839">表单说明</a></span><span class="md-toc-item md-toc-h4" data-ref="n870"><a class="md-toc-inner" href="#header-n870">发票头</a></span><span class="md-toc-item md-toc-h4" data-ref="n1057"><a class="md-toc-inner" href="#header-n1057">发票明细</a></span><span class="md-toc-item md-toc-h4" data-ref="n1213"><a class="md-toc-inner" href="#header-n1213">邮件推送配置</a></span><span class="md-toc-item md-toc-h4" data-ref="n1256"><a class="md-toc-inner" href="#header-n1256">短信推送配置</a></span><span class="md-toc-item md-toc-h4" data-ref="n1299"><a class="md-toc-inner" href="#header-n1299">回调服务配置</a></span><span class="md-toc-item md-toc-h4" data-ref="n1343"><a class="md-toc-inner" href="#header-n1343">请求样例</a></span><span class="md-toc-item md-toc-h3" data-ref="n1365"><a class="md-toc-inner" href="#header-n1365">返回结果说明</a></span><span class="md-toc-item md-toc-h4" data-ref="n1388"><a class="md-toc-inner" href="#header-n1388">返回样例</a></span><span class="md-toc-item md-toc-h2" data-ref="n1391"><a class="md-toc-inner" href="#header-n1391">3、开票状态查询服务</a></span><span class="md-toc-item md-toc-h3" data-ref="n1392"><a class="md-toc-inner" href="#header-n1392">请求说明</a></span><span class="md-toc-item md-toc-h3" data-ref="n1400"><a class="md-toc-inner" href="#header-n1400">请求头参数</a></span><span class="md-toc-item md-toc-h3" data-ref="n1420"><a class="md-toc-inner" href="#header-n1420">请求体参数</a></span><span class="md-toc-item md-toc-h4" data-ref="n1440"><a class="md-toc-inner" href="#header-n1440">请求样例</a></span><span class="md-toc-item md-toc-h3" data-ref="n1446"><a class="md-toc-inner" href="#header-n1446">返回结果说明</a></span><span class="md-toc-item md-toc-h4" data-ref="n1489"><a class="md-toc-inner" href="#header-n1489">返回样例</a></span><span class="md-toc-item md-toc-h2" data-ref="n1492"><a class="md-toc-inner" href="#header-n1492">4、发票红冲请求服务</a></span><span class="md-toc-item md-toc-h3" data-ref="n1493"><a class="md-toc-inner" href="#header-n1493">请求说明</a></span><span class="md-toc-item md-toc-h3" data-ref="n1502"><a class="md-toc-inner" href="#header-n1502">请求头参数</a></span><span class="md-toc-item md-toc-h3" data-ref="n1524"><a class="md-toc-inner" href="#header-n1524">请求体参数</a></span><span class="md-toc-item md-toc-h4" data-ref="n1525"><a class="md-toc-inner" href="#header-n1525">表单说明</a></span><span class="md-toc-item md-toc-h4" data-ref="n1557"><a class="md-toc-inner" href="#header-n1557">发票红冲参数</a></span><span class="md-toc-item md-toc-h4" data-ref="n1632"><a class="md-toc-inner" href="#header-n1632">邮件推送配置</a></span><span class="md-toc-item md-toc-h4" data-ref="n1634"><a class="md-toc-inner" href="#header-n1634">短信推送配置</a></span><span class="md-toc-item md-toc-h4" data-ref="n1661"><a class="md-toc-inner" href="#header-n1661">回调服务配置</a></span><span class="md-toc-item md-toc-h4" data-ref="n1730"><a class="md-toc-inner" href="#header-n1730">请求样例</a></span><span class="md-toc-item md-toc-h3" data-ref="n1736"><a class="md-toc-inner" href="#header-n1736">返回结果说明</a></span><span class="md-toc-item md-toc-h4" data-ref="n1754"><a class="md-toc-inner" href="#header-n1754">返回样例</a></span><span class="md-toc-item md-toc-h2" data-ref="n1757"><a class="md-toc-inner" href="#header-n1757">5、开票申请审核通过</a></span><span class="md-toc-item md-toc-h3" data-ref="n1759"><a class="md-toc-inner" href="#header-n1759">请求说明</a></span><span class="md-toc-item md-toc-h3" data-ref="n1768"><a class="md-toc-inner" href="#header-n1768">请求头参数</a></span><span class="md-toc-item md-toc-h3" data-ref="n1789"><a class="md-toc-inner" href="#header-n1789">请求体参数</a></span><span class="md-toc-item md-toc-h4" data-ref="n1790"><a class="md-toc-inner" href="#header-n1790">表单说明</a></span><span class="md-toc-item md-toc-h4" data-ref="n1792"><a class="md-toc-inner" href="#header-n1792">发票开具动作参数</a></span><span class="md-toc-item md-toc-h4" data-ref="n1836"><a class="md-toc-inner" href="#header-n1836">请求样例</a></span><span class="md-toc-item md-toc-h3" data-ref="n1838"><a class="md-toc-inner" href="#header-n1838">返回结果说明</a></span><span class="md-toc-item md-toc-h4" data-ref="n1857"><a class="md-toc-inner" href="#header-n1857">返回样例</a></span><span class="md-toc-item md-toc-h2" data-ref="n1860"><a class="md-toc-inner" href="#header-n1860">6、电子发票部分红冲</a></span><span class="md-toc-item md-toc-h3" data-ref="n1861"><a class="md-toc-inner" href="#header-n1861">请求说明</a></span><span class="md-toc-item md-toc-h3" data-ref="n1870"><a class="md-toc-inner" href="#header-n1870">请求头参数</a></span><span class="md-toc-item md-toc-h3" data-ref="n1894"><a class="md-toc-inner" href="#header-n1894">请求体参数</a></span><span class="md-toc-item md-toc-h4" data-ref="n1895"><a class="md-toc-inner" href="#header-n1895">表单说明</a></span><span class="md-toc-item md-toc-h4" data-ref="n1926"><a class="md-toc-inner" href="#header-n1926">发票头</a></span><span class="md-toc-item md-toc-h4" data-ref="n2041"><a class="md-toc-inner" href="#header-n2041">发票明细</a></span><span class="md-toc-item md-toc-h4" data-ref="n2149"><a class="md-toc-inner" href="#header-n2149">邮件推送配置</a></span><span class="md-toc-item md-toc-h4" data-ref="n2176"><a class="md-toc-inner" href="#header-n2176">短信推送配置</a></span><span class="md-toc-item md-toc-h4" data-ref="n2203"><a class="md-toc-inner" href="#header-n2203">回调服务配置</a></span><span class="md-toc-item md-toc-h4" data-ref="n2247"><a class="md-toc-inner" href="#header-n2247">请求样例</a></span><span class="md-toc-item md-toc-h2" data-ref="n2261"><a class="md-toc-inner" href="#header-n2261">附录</a></span><span class="md-toc-item md-toc-h3" data-ref="n2262"><a class="md-toc-inner" href="#header-n2262">状态码</a></span><span class="md-toc-item md-toc-h3" data-ref="n2281"><a class="md-toc-inner" href="#header-n2281">NCC友企联回调数据样例</a></span><span class="md-toc-item md-toc-h3" data-ref="n2283"><a class="md-toc-inner" href="#header-n2283">常规回调数据样例</a></span><span class="md-toc-item md-toc-h3" data-ref="n2285"><a class="md-toc-inner" href="#header-n2285">回调服务参数</a></span><span class="md-toc-item md-toc-h3" data-ref="n2328"><a class="md-toc-inner" href="#header-n2328">回调服务发票详细信息</a></span><span class="md-toc-item md-toc-h3" data-ref="n2541"><a class="md-toc-inner" href="#header-n2541">回调服务返回结果</a></span><span class="md-toc-item md-toc-h3" data-ref="n2562"><a class="md-toc-inner" href="#header-n2562">样例代码</a></span><span class="md-toc-item md-toc-h4" data-ref="n2567"><a class="md-toc-inner" href="#header-n2567"><strong>Java（适用于JDK1.6及其更高版本）</strong></a></span><span class="md-toc-item md-toc-h5" data-ref="n2568"><a class="md-toc-inner" href="#header-n2568"><strong>Maven配置文件依赖</strong></a></span><span class="md-toc-item md-toc-h5" data-ref="n2572"><a class="md-toc-inner" href="#header-n2572"><strong>API调用代码</strong></a></span><span class="md-toc-item md-toc-h5" data-ref="n2574"><a class="md-toc-inner" href="#header-n2574"><strong>API相关工具类</strong></a></span><span class="md-toc-item md-toc-h4" data-ref="n2576"><a class="md-toc-inner" href="#header-n2576"><strong>Java（适用于JDK1.5）</strong></a></span><span class="md-toc-item md-toc-h5" data-ref="n2577"><a class="md-toc-inner" href="#header-n2577"><strong>Maven配置文件依赖</strong></a></span><span class="md-toc-item md-toc-h5" data-ref="n2581"><a class="md-toc-inner" href="#header-n2581"><strong>API调用代码</strong></a></span><span class="md-toc-item md-toc-h5" data-ref="n2583"><a class="md-toc-inner" href="#header-n2583"><strong>API相关工具类</strong></a></span><span class="md-toc-item md-toc-h4" data-ref="n2585"><a class="md-toc-inner" href="#header-n2585"><strong>C#</strong></a></span><span class="md-toc-item md-toc-h5" data-ref="n2586"><a class="md-toc-inner" href="#header-n2586">添加引用</a></span><span class="md-toc-item md-toc-h5" data-ref="n2595"><a class="md-toc-inner" href="#header-n2595">API调用代码</a></span><span class="md-toc-item md-toc-h4" data-ref="n2597"><a class="md-toc-inner" href="#header-n2597"><strong>PHP</strong></a></span><span class="md-toc-item md-toc-h5" data-ref="n2598"><a class="md-toc-inner" href="#header-n2598">添加引用</a></span><span class="md-toc-item md-toc-h5" data-ref="n2602"><a class="md-toc-inner" href="#header-n2602">API调用代码</a></span></p></div><h2><a name='header-n218' class='md-header-anchor '></a>1、开票蓝票请求服务</h2><h3><a name='header-n219' class='md-header-anchor '></a>请求说明</h3><blockquote><p>URL:<code>https://&lt;HOST&gt;:&lt;PORT&gt;/invoiceclient-web/api/invoiceApply/insertWithArray?appid=XXXXX</code>
格式：application/x-www-form-urlencoded; charset=UTF-8
http请求方式：POST
编码类型：UTF-8
<font color="red"><strong>每次请求的数据不能超过10张单据<br>此接口只能用来开具蓝票</strong></font></p></blockquote><hr /><h3><a name='header-n228' class='md-header-anchor '></a>请求头参数</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th style='text-align:right;' >类型</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >描述</th><th>备注</th></tr></thead><tbody><tr><td style='text-align:left;' >sign</td><td style='text-align:right;' >String</td><td style='text-align:center;' >是</td><td style='text-align:center;' >请求签名信息</td><td>使用JWT生成token</td></tr></tbody></table></figure></blockquote><blockquote><p>JWT签名说明详见 <a href='https://jwt.io/' target='_blank' class='url'>https://jwt.io/</a>，各类编程语言参考官网的支持列表。
一个JWT实际上就是一个字符串，它由三部分组成，头部、载荷与签名。
<strong>注意事项</strong><font color ="red">
1、签名使用的密钥必须必须与平台appid注册的一致
2、签名载荷（Payload）中必须包含属性requestdatas，它的值为表单参数requestdatas的MD5值
3、具体使用方式参考<a href='#header-n2562'>样例代码</a>示例</p></blockquote><hr /><h3><a name='header-n252' class='md-header-anchor '></a>请求体参数</h3><h4><a name='header-n253' class='md-header-anchor '></a>表单说明</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >requestdatas</td><td style='text-align:left;' >开票申请发票信息，包含<a href='#header-n285'>发票头</a>、<a href='#header-n497'>发票明细</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >email</td><td style='text-align:left;' ><a href='#header-n662'>邮件推送配置(可选)</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >sms</td><td style='text-align:left;' ><a href='#header-n664'>短信推送配置(可选)</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >url</td><td style='text-align:left;' ><a href='#header-n691'>回调服务配置(可选)</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >autoAudit</td><td style='text-align:left;' >是否自动审核(可选)</td><td style='text-align:left;' >true:自动审核，即不需要人工在发票平台确认开票，直接进行开票 false:不自动审核，即需要人工确认<br>如果不传，代表true</td></tr><tr><td style='text-align:left;' >nc6x-ubl</td><td style='text-align:left;' >ncc友企联回调参数</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><h4><a name='header-n285' class='md-header-anchor '></a>发票头</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">FPQQLSH</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >FPLX</td><td>String</td><td style='text-align:center;' >1</td><td style='text-align:center;' >否</td><td style='text-align:center;' >1</td><td style='text-align:left;' >发票类型</td><td style='text-align:left;' >1：增值税电子普通发票；<BR>3：增值税普通发票；<BR>4：增值税专用发票 ；<BR>8：增值税电子普通发票（成品油）；<BR>9：成品油普通发票(卷式)<BR>10：成品油普通发票；<BR>11：成品油专用发票；<BR>12：增值税普通发票(卷式)</td></tr><tr><td style='text-align:left;' ><font color="red">XSF_NSRSBH</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >销售方纳税人识别号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >XSF_MC</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >销售方名称</td><td style='text-align:left;' >如果为空，获取发票平台配置的销售方名称</td></tr><tr><td style='text-align:left;' >XSF_DZDH</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >销售方地址、电话</td><td style='text-align:left;' >如果为空，获取发票平台配置的销售方名称</td></tr><tr><td style='text-align:left;' >XSF_YHZH</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >销售方银行账号</td><td style='text-align:left;' >如果为空，获取发票平台配置的销售方名称</td></tr><tr><td style='text-align:left;' >GMF_NSRSBH</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >购买方纳税人识别号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="red">GMF_MC</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >购买方名称</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >GMF_DZDH</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >购买方地址、电话</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >GMF_YHZH</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >购买方银行账号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >KPR</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >开票人</td><td style='text-align:left;' >如果为空，获取发票平台配置的开票人</td></tr><tr><td style='text-align:left;' >SKR</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >收款人</td><td style='text-align:left;' >如果为空，获取发票平台配置的收款人</td></tr><tr><td style='text-align:left;' >FHR</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >复核人</td><td style='text-align:left;' >如果为空，获取发票平台配置的复核人</td></tr><tr><td style='text-align:left;' ><font color="red">JSHJ</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >价税合计</td><td style='text-align:left;' >两位小数。明细价税合计之和必须与总的价税合计一致</td></tr><tr><td style='text-align:left;' >HJJE</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >合计金额</td><td style='text-align:left;' >两位小数。为空时，根据明细项目进行合计。</td></tr><tr><td style='text-align:left;' >HJSE</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >合计税额</td><td style='text-align:left;' >两位小数。为空时，根据明细项目进行合计。</td></tr><tr><td style='text-align:left;' >BZ</td><td>String</td><td style='text-align:center;' >200</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >备注</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >LYID</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >请求来源唯一标识</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >BMB_BBH</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >编码版本号</td><td style='text-align:left;' >增加商品编码功能后，税局下载的商品编码表版本</td></tr><tr><td style='text-align:left;' ><font color="blue">ORGCODE</td><td>String</td><td style='text-align:center;' >50</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >开票点编码</td><td style='text-align:left;' >如果一个税号对应多个开票点，此字段必输，用于确定唯一开票点</td></tr><tr><td style='text-align:left;' >WXORDERID</td><td>String</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >微信订单号</td><td style='text-align:left;' >商户开票完成后，传入订单号和商户id将自动插入用户微信卡包</td></tr><tr><td style='text-align:left;' >WXAPPID</td><td>String</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >微信商户id</td><td style='text-align:left;' >商户开票完成后，传入订单号和商户id将自动插入用户微信卡包</td></tr><tr><td style='text-align:left;' >WXAUTHID</td><td>String</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >微信批量插入卡包的授权id</td><td style='text-align:left;' >如果使用批量插入卡包的授权，需要传此参数，否则不需要</td></tr><tr><td style='text-align:left;' >ZDYBZ</td><td>String</td><td style='text-align:center;' >200</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >自定义备注</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >SGBZ</td><td>String</td><td style='text-align:center;' >1</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >收购标志</td><td style='text-align:left;' >2-农产品收购</td></tr></tbody></table></figure></blockquote><h4><a name='header-n497' class='md-header-anchor '></a>发票明细</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >FPHXZ</td><td>Integer</td><td style='text-align:center;' >1</td><td style='text-align:center;' >否</td><td style='text-align:center;' >0</td><td style='text-align:left;' >发票行性质</td><td style='text-align:left;' >0-正常行1-折扣行2-被折扣行；如果是</td></tr><tr><td style='text-align:left;' ><font color="red">XMMC</td><td>String</td><td style='text-align:center;' >90</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目名称</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="red">XMBM</td><td>String</td><td style='text-align:center;' >90</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目编码</td><td style='text-align:left;' >如果项目名称为空，会根据项目编码匹配云平台的商品档案</td></tr><tr><td style='text-align:left;' >GGXH</td><td>String</td><td style='text-align:center;' >40</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >规格型号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >DW</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >单位</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >XMSL</td><td>Double</td><td style='text-align:center;' >15,6</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目数量</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >XMDJ</td><td>Double</td><td style='text-align:center;' >15,6</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目单价</td><td style='text-align:left;' >项目单价为空时，根据项目金额反算。不为空时不进行计算</td></tr><tr><td style='text-align:left;' >XMJE</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目金额</td><td style='text-align:left;' >项目金额为空，根据项目价税合计反算。不为空时不进行计算</td></tr><tr><td style='text-align:left;' ><font color="red">XMJSHJ</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目价税合计</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="red">SL</td><td>Double</td><td style='text-align:center;' >6,6</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >税率</td><td style='text-align:left;' >6 位小数，例 17%为 0.17</td></tr><tr><td style='text-align:left;' >SE</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >税额</td><td style='text-align:left;' >税额为空，根据价税合计反算。不为空时不进行计算。</td></tr><tr><td style='text-align:left;' >HH</td><td>string</td><td style='text-align:center;' >60</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >行号</td><td style='text-align:left;' >有折扣时需要必输</td></tr><tr><td style='text-align:left;' >ZKHHH</td><td>string</td><td style='text-align:center;' >60</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >折扣行行号</td><td style='text-align:left;' >有折扣时需要必输</td></tr><tr><td style='text-align:left;' ><font color="red">SPBM</td><td>string</td><td style='text-align:center;' >19</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >商品编码</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >ZXBM</td><td>string</td><td style='text-align:center;' >20</td><td style='text-align:center;' >否</td><td style='text-align:center;' >10</td><td style='text-align:left;' >商品自行编码</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="blue">YHZCBS</td><td>int</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:center;' >否</td><td style='text-align:center;' >0</td><td style='text-align:left;' >销售优惠标识</td><td style='text-align:left;' >0：不使用，1：使用</td></tr><tr><td style='text-align:left;' ><font color="blue">LSLBS</td><td>string</td><td style='text-align:center;' >1</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >零税率标识</td><td style='text-align:left;' >空：非零利率，0：出口退税，1：免税，2：不征收，3普通零税率</td></tr><tr><td style='text-align:left;' ><font color="blue">ZZSTSGL</td><td>string</td><td style='text-align:center;' >50</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >优惠政策说明</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="blue">KCE</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >扣除额</td><td style='text-align:left;' >扣除额</td></tr></tbody></table></figure></blockquote><hr /><h4><a name='header-n662' class='md-header-anchor '></a>邮件推送配置</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">fpqqlsh</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >必须和上面的开票请求对应</td></tr><tr><td style='text-align:left;' ><font color="red">address</td><td>String</td><td style='text-align:center;' >500</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >接收地址</td><td style='text-align:left;' >接收地址，多个地址使用&quot;,&quot;分隔开</td></tr></tbody></table></figure></blockquote><h4><a name='header-n664' class='md-header-anchor '></a>短信推送配置</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">fpqqlsh</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >必须和上面的开票请求对应</td></tr><tr><td style='text-align:left;' ><font color="red">address</td><td>String</td><td style='text-align:center;' >500</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >接收地址</td><td style='text-align:left;' >接收地址，多个地址使用&quot;,&quot;分隔开</td></tr></tbody></table></figure></blockquote><h4><a name='header-n691' class='md-header-anchor '></a>回调服务配置</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">fpqqlsh</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >必须和上面的开票请求对应</td></tr><tr><td style='text-align:left;' ><font color="red">url</td><td>String</td><td style='text-align:center;' >500</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >回调url</td><td style='text-align:left;' >开票申请调用方配置回调url，当电子发票开具成功后，调用此服务，POST电子发票相关信息。信息包含：1、pdf版式文件2、发票数据、3、发票下载链接<font color="red">ncc通过友企联方案回调可不传此参数</td></tr><tr><td style='text-align:left;' >intf</td><td>String</td><td style='text-align:center;' >200</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >ncc回调接口名</td><td style='text-align:left;' >ncc通过友企联方案回调时必传</td></tr><tr><td style='text-align:left;' >method</td><td>String</td><td style='text-align:center;' >200</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >ncc回调方法名</td><td style='text-align:left;' >ncc通过友企联方案回调时必传</td></tr></tbody></table></figure></blockquote><hr /><h4><a name='header-n760' class='md-header-anchor '></a>请求样例</h4><blockquote><p>表单参数如下</p></blockquote><pre class="md-fences md-end-block" lang="" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">requestdatas=[ {</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"FPQQLSH" : "12345678901234567890",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"XSF_NSRSBH" : "销售方纳税人识别号",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"XSF_MC" : "销售方名称",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"XSF_DZDH" : "销售方地址、电话",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"XSF_YHZH" : "销售方银行账号",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"GMF_NSRSBH" : "购买方纳税人识别号",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"GMF_MC" : "购买方名称",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"GMF_DZDH" : "购买方地址、电话",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"GMF_YHZH" : "购买方银行账号",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"KPR" : "开票人",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"SKR" : "收款人",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"FHR" : "复核人",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"JSHJ" : "价税合计",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"HJJE" : "合计金额",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"HJSE" : "合计税额",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"BZ" : "备注",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"BMB_BBH" : "10.0",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"items" : [{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "FPHXZ" : "发票行性质",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "XMMC" : "项目名称",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "GGXH" : "规格型号",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "DW" : "单位",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "XMSL" : "项目数量",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "XMDJ" : "项目单价",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "XMJE" : "项目金额",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "XMJSHJ" : "项目价税合计",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "SL" : "税率",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "SE" : "税额",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "HH":"行号",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "SPBM":"商品编码",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "ZXBM":"自行编码"</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "KCE":300</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&amp;email=[</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  "fpqqlsh":"12345678901234567890",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "address": "x1@yonyou.com,x2@yonyou.com"</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }, </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  "fpqqlsh":"12345678901234567890",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "address": "x3@yonyou.com"</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&amp;sms=[{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"fpqqlsh":"12345678901234567890",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "address": "13511111111,13511111112"</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&amp;url=[{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>"fpqqlsh":"12345678901234567890",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "url": "http://url.com/msg"</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&amp;nc6x-ubl=[{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "fpqqlsh":"12345678901234567890",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "method":"queryUserPermAppPksOrCodes",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "intf":"nccloud.pubitf.baseapp.apprbac.IAppAndOrgPermQueryPubService" &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&amp;autoAudit=true</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 1388px;"></div><div class="CodeMirror-gutters" style="display: none; height: 1418px;"></div></div></div></pre><p>普通开票最小参数样例</p><blockquote><p>销售方地址电话、银行账号、销售方名称可以通过销售方纳税人识别号获取</p></blockquote><pre class="md-fences md-end-block" lang="json" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable">requestdatas</span><span class="cm-operator">=</span>[{</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"FPQQLSH"</span> : <span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"XSF_NSRSBH"</span> : <span class="cm-string">"销售方纳税人识别号"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"GMF_MC"</span> : <span class="cm-string">"购买方名称"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"JSHJ"</span> : <span class="cm-number">117</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"items"</span> : </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  [</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMMC"</span> : <span class="cm-string">"项目名称"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMJSHJ"</span> : <span class="cm-number">117</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"SL"</span> : <span class="cm-number">0.17</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"SPBM"</span> : <span class="cm-string">"1010101020000000000"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  ]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}]</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 353px;"></div><div class="CodeMirror-gutters" style="display: none; height: 383px;"></div></div></div></pre><p>包含折扣行开票样例</p><blockquote><p>包含折扣行的单据需要增加以下信息
 FPHXZ：发票行性质
 HH：行号
 ZKHHH：折扣行行号
 <font color="red">折扣行上规则型号、单位、数量、单价 不用设值。折扣行的项目名称必须与被折扣行一样。被折扣行记录对应折扣行行号 。</p></blockquote><pre class="md-fences md-end-block" lang="json" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable">requestdatas</span><span class="cm-operator">=</span>[{</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"FPQQLSH"</span> : <span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"XSF_NSRSBH"</span> : <span class="cm-string">"销售方纳税人识别号"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"GMF_MC"</span> : <span class="cm-string">"购买方名称"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"JSHJ"</span> : <span class="cm-number">799</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"items"</span> : </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  [</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp;<span class="cm-string cm-property">"FPHXZ"</span> : <span class="cm-number">2</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMMC"</span> : <span class="cm-string">"项目名称"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMSL"</span> : <span class="cm-number">1</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMJSHJ"</span> : <span class="cm-number">899</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"SL"</span> : <span class="cm-number">0.17</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"HH"</span>:<span class="cm-string">"1"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"ZKHHH"</span>:<span class="cm-string">"2"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp;  },</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"FPHXZ"</span> : <span class="cm-number">1</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMMC"</span> : <span class="cm-string">"项目名称"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMJSHJ"</span> : <span class="cm-operator">-</span><span class="cm-number">100</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"SL"</span> : <span class="cm-number">0.17</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"HH"</span>:<span class="cm-string">"2"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  ]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}]</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 583px;"></div><div class="CodeMirror-gutters" style="display: none; height: 613px;"></div></div></div></pre><hr /><h3><a name='header-n782' class='md-header-anchor '></a>返回结果说明</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >code</td><td>String</td><td style='text-align:left;' >状态码</td><td style='text-align:left;' ><a href='#header-n2262'>详见状态码说明</a></td></tr><tr><td style='text-align:left;' >msg</td><td>String</td><td style='text-align:left;' >信息说明</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><h4><a name='header-n801' class='md-header-anchor '></a>返回样例</h4><pre class="md-fences md-end-block" lang="json"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">{</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"code"</span>: <span class="cm-string">"0000"</span>, </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"msg"</span>: <span class="cm-string">"success"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 100px;"></div><div class="CodeMirror-gutters" style="display: none; height: 130px;"></div></div></div></pre><hr /><h2><a name='header-n804' class='md-header-anchor '></a>2、开票蓝票请求服务--发票拆分</h2><h3><a name='header-n805' class='md-header-anchor '></a>请求说明</h3><blockquote><p>URL:<code>https://&lt;HOST&gt;:&lt;PORT&gt;/invoiceclient-web/api/invoiceApply/insertWithSplit?appid=XXXXX</code>
格式：application/x-www-form-urlencoded; charset=UTF-8
http请求方式：POST
编码类型：UTF-8
<font color="red"><strong>每次请求的数据不能超过10张单据<br>此接口只能用来开具蓝票</strong></font></p></blockquote><hr /><h3><a name='header-n814' class='md-header-anchor '></a>请求头参数</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th style='text-align:right;' >类型</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >描述</th><th>备注</th></tr></thead><tbody><tr><td style='text-align:left;' >sign</td><td style='text-align:right;' >String</td><td style='text-align:center;' >是</td><td style='text-align:center;' >请求签名信息</td><td>使用JWT生成token</td></tr></tbody></table></figure></blockquote><blockquote><p>JWT签名说明详见 <a href='https://jwt.io/' target='_blank' class='url'>https://jwt.io/</a>，各类编程语言参考官网的支持列表。
一个JWT实际上就是一个字符串，它由三部分组成，头部、载荷与签名。
<strong>注意事项</strong><font color ="red">
1、签名使用的密钥必须必须与平台appid注册的一致
2、签名载荷（Payload）中必须包含属性requestdatas，它的值为表单参数requestdatas的MD5值
3、具体使用方式参考<a href='#header-n2562'>样例代码</a>示例</font></p></blockquote><hr /><h3><a name='header-n838' class='md-header-anchor '></a>请求体参数</h3><h4><a name='header-n839' class='md-header-anchor '></a>表单说明</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >requestdatas</td><td style='text-align:left;' >开票申请发票信息，包含<a href='#header-n285'>发票头</a>、<a href='#header-n497'>发票明细</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >email</td><td style='text-align:left;' ><a href='#header-n662'>邮件推送配置(可选)</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >sms</td><td style='text-align:left;' ><a href='#header-n664'>短信推送配置(可选)</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >url</td><td style='text-align:left;' ><a href='#header-n691'>回调服务配置(可选)</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >autoAudit</td><td style='text-align:left;' >是否自动审核(可选)</td><td style='text-align:left;' >true:自动审核，即不需要人工在发票平台确认开票，直接进行开票 false:不自动审核，即需要人工确认<br>如果不传，代表true</td></tr><tr><td style='text-align:left;' >nc6x-ubl</td><td style='text-align:left;' >ncc友企联回调参数</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><h4><a name='header-n870' class='md-header-anchor '></a>发票头</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">FPQQLSH</font></td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >FPLX</td><td>String</td><td style='text-align:center;' >1</td><td style='text-align:center;' >否</td><td style='text-align:center;' >1</td><td style='text-align:left;' >发票类型</td><td style='text-align:left;' >1：增值税电子普通发票；3：增值税普通发票；4：增值税专用发票</td></tr><tr><td style='text-align:left;' ><font color="red">XSF_NSRSBH</font></td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >销售方纳税人识别号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="red">XSF_MC</font></td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >销售方名称</td><td style='text-align:left;' >如果为空，获取发票平台配置的销售方名称</td></tr><tr><td style='text-align:left;' ><font color="red">XSF_DZDH</font></td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >销售方地址、电话</td><td style='text-align:left;' >如果为空，获取发票平台配置的销售方名称</td></tr><tr><td style='text-align:left;' >XSF_YHZH</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >销售方银行账号</td><td style='text-align:left;' >如果为空，获取发票平台配置的销售方名称</td></tr><tr><td style='text-align:left;' >GMF_NSRSBH</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >购买方纳税人识别号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="red">GMF_MC</font></td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >购买方名称</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >GMF_DZDH</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >购买方地址、电话</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >GMF_YHZH</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >购买方银行账号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >KPR</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >开票人</td><td style='text-align:left;' >如果为空，获取发票平台配置的开票人</td></tr><tr><td style='text-align:left;' >SKR</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >收款人</td><td style='text-align:left;' >如果为空，获取发票平台配置的收款人</td></tr><tr><td style='text-align:left;' >FHR</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >复核人</td><td style='text-align:left;' >如果为空，获取发票平台配置的复核人</td></tr><tr><td style='text-align:left;' ><font color="red">JSHJ</font></td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >价税合计</td><td style='text-align:left;' >两位小数。明细价税合计之和必须与总的价税合计一致</td></tr><tr><td style='text-align:left;' >HJJE</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >合计金额</td><td style='text-align:left;' >两位小数。为空时，根据明细项目进行合计。</td></tr><tr><td style='text-align:left;' >HJSE</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >合计税额</td><td style='text-align:left;' >两位小数。为空时，根据明细项目进行合计。</td></tr><tr><td style='text-align:left;' >BZ</td><td>String</td><td style='text-align:center;' >200</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >备注</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >LYID</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >请求来源唯一标识</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="blue">BMB_BBH</font></td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >否</td><td style='text-align:center;' >13.0</td><td style='text-align:left;' >编码版本号</td><td style='text-align:left;' >增加商品编码功能后，税局下载的商品编码表版本</td></tr><tr><td style='text-align:left;' ><font color="blue">ORGCODE</font></td><td>String</td><td style='text-align:center;' >50</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >开票点编码</td><td style='text-align:left;' >支持一个公司多个开票点场景。如果为空，获取默认的开票点</td></tr><tr><td style='text-align:left;' >WXORDERID</td><td>String</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >微信订单号</td><td style='text-align:left;' >商户开票完成后，传入订单号和商户id将自动插入用户微信卡包</td></tr><tr><td style='text-align:left;' >WXAPPID</td><td>String</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >微信商户id</td><td style='text-align:left;' >商户开票完成后，传入订单号和商户id将自动插入用户微信卡包</td></tr></tbody></table></figure></blockquote><h4><a name='header-n1057' class='md-header-anchor '></a>发票明细</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >FPHXZ</td><td>Integer</td><td style='text-align:center;' >1</td><td style='text-align:center;' >否</td><td style='text-align:center;' >0</td><td style='text-align:left;' >发票行性质</td><td style='text-align:left;' >0-正常行1-折扣行2-被折扣行；如果是</td></tr><tr><td style='text-align:left;' ><font color="red">XMMC</font></td><td>String</td><td style='text-align:center;' >90</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目名称</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >GGXH</td><td>String</td><td style='text-align:center;' >40</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >规格型号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >DW</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >单位</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >XMSL</td><td>Double</td><td style='text-align:center;' >15,6</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目数量</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >XMDJ</td><td>Double</td><td style='text-align:center;' >15,6</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目单价</td><td style='text-align:left;' >项目单价为空时，根据项目金额反算。不为空时不进行计算</td></tr><tr><td style='text-align:left;' >XMJE</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目金额</td><td style='text-align:left;' >项目金额为空，根据项目价税合计反算。不为空时不进行计算</td></tr><tr><td style='text-align:left;' ><font color="red">XMJSHJ</font></td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目价税合计</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="red">SL</font></td><td>Double</td><td style='text-align:center;' >6,6</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >税率</td><td style='text-align:left;' >6 位小数，例 17%为 0.17</td></tr><tr><td style='text-align:left;' >SE</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >税额</td><td style='text-align:left;' >税额为空，根据价税合计反算。不为空时不进行计算。</td></tr><tr><td style='text-align:left;' >HH</td><td>string</td><td style='text-align:center;' >60</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >行号</td><td style='text-align:left;' >有折扣时需要必输</td></tr><tr><td style='text-align:left;' >ZKHHH</td><td>string</td><td style='text-align:center;' >60</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >折扣行行号</td><td style='text-align:left;' >有折扣时需要必输</td></tr><tr><td style='text-align:left;' ><font color="blue">SPBM</font></td><td>string</td><td style='text-align:center;' >19</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >商品编码</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >ZXBM</td><td>string</td><td style='text-align:center;' >20</td><td style='text-align:center;' >否</td><td style='text-align:center;' >10</td><td style='text-align:left;' >商品自行编码</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="blue">YHZCBS</font></td><td>int</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:center;' >否</td><td style='text-align:center;' >0</td><td style='text-align:left;' >销售优惠标识</td><td style='text-align:left;' >0：不使用，1：使用</td></tr><tr><td style='text-align:left;' ><font color="blue">LSLBS</font></td><td>string</td><td style='text-align:center;' >1</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >零税率标识</td><td style='text-align:left;' >空：非零利率，0：出口退税，1：免税，2：不征收，3普通零税率</td></tr><tr><td style='text-align:left;' ><font color="blue">ZZSTSGL</font></td><td>string</td><td style='text-align:center;' >50</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >优惠政策说明</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="blue">KCE</font></td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >扣除额</td><td style='text-align:left;' >扣除额</td></tr></tbody></table></figure></blockquote><hr /><h4><a name='header-n1213' class='md-header-anchor '></a>邮件推送配置</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">fpqqlsh</font></td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >必须和上面的开票请求对应</td></tr><tr><td style='text-align:left;' ><font color="red">address</font></td><td>String</td><td style='text-align:center;' >500</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >接收地址</td><td style='text-align:left;' >接收地址，多个地址使用&quot;,&quot;分隔开</td></tr><tr><td style='text-align:left;' >title</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >标题</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >content</td><td>String</td><td style='text-align:center;' >1000</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >消息内容</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><h4><a name='header-n1256' class='md-header-anchor '></a>短信推送配置</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">fpqqlsh</font></td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >必须和上面的开票请求对应</td></tr><tr><td style='text-align:left;' ><font color="red">address</font></td><td>String</td><td style='text-align:center;' >500</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >接收地址</td><td style='text-align:left;' >接收地址，多个地址使用&quot;,&quot;分隔开</td></tr><tr><td style='text-align:left;' >title</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >标题</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >content</td><td>String</td><td style='text-align:center;' >1000</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >消息内容</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><h4><a name='header-n1299' class='md-header-anchor '></a>回调服务配置</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">fpqqlsh</font></td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >必须和上面的开票请求对应</td></tr><tr><td style='text-align:left;' ><font color="red">url</font></td><td>String</td><td style='text-align:center;' >500</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >回调url</td><td style='text-align:left;' >开票申请调用方配置回调url，当电子发票开具成功后，调用此服务，POST电子发票相关信息。信息包含：1、pdf版式文件2、发票数据、3、发票下载链接<font color="red">ncc通过友企联方案回调可不传此参数</td></tr><tr><td style='text-align:left;' >intf</td><td>String</td><td style='text-align:center;' >200</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >ncc回调接口名</td><td style='text-align:left;' >ncc通过友企联方案回调时必传</td></tr><tr><td style='text-align:left;' >method</td><td>String</td><td style='text-align:center;' >200</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >ncc回调方法名</td><td style='text-align:left;' >ncc通过友企联方案回调时必传</td></tr></tbody></table></figure></blockquote><hr /><h4><a name='header-n1343' class='md-header-anchor '></a>请求样例</h4><blockquote><p>表单参数如下</p></blockquote><pre class="md-fences md-end-block" lang="" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">requestdatas=[ {</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"FPQQLSH" : "12345678901234567890",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"XSF_NSRSBH" : "销售方纳税人识别号",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"XSF_MC" : "销售方名称",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"XSF_DZDH" : "销售方地址、电话",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"XSF_YHZH" : "销售方银行账号",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"GMF_NSRSBH" : "购买方纳税人识别号",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"GMF_MC" : "购买方名称",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"GMF_DZDH" : "购买方地址、电话",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"GMF_YHZH" : "购买方银行账号",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"KPR" : "开票人",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"SKR" : "收款人",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"FHR" : "复核人",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"JSHJ" : "价税合计",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"HJJE" : "合计金额",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"HJSE" : "合计税额",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"BZ" : "备注",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"BMB_BBH" : "10.0",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"items" : [{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "FPHXZ" : "发票行性质",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "XMMC" : "项目名称",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "GGXH" : "规格型号",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "DW" : "单位",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "XMSL" : "项目数量",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "XMDJ" : "项目单价",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "XMJE" : "项目金额",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "XMJSHJ" : "项目价税合计",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "SL" : "税率",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "SE" : "税额",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "HH":"行号",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "SPBM":"商品编码",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "ZXBM":"自行编码"</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "KCE":300</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&amp;email=[</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  "fpqqlsh":"12345678901234567890",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "address": "x1@yonyou.com,x2@yonyou.com", </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "title": "电子发票", </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "content": "订单XXX电子发票。"</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }, </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  "fpqqlsh":"12345678901234567890",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "address": "x3@yonyou.com", </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "title": "电子发票", </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "content": "订单XXX电子发票。"</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&amp;sms=[{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>"fpqqlsh":"12345678901234567890",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "address": "13511111111,13511111112", </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "title": "电子发票", </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "content": "订单XXX电子发票。"</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&amp;url=[{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>"fpqqlsh":"12345678901234567890",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "url": "http://url.com/msg"</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&amp;nc6x-ubl=[{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "fpqqlsh":"12345678901234567890",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "method":"queryUserPermAppPksOrCodes",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  "intf":"nccloud.pubitf.baseapp.apprbac.IAppAndOrgPermQueryPubService" &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&amp;autoAudit=true</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 1526px;"></div><div class="CodeMirror-gutters" style="display: none; height: 1556px;"></div></div></div></pre><p>普通开票最小参数样例</p><blockquote><p>销售方地址电话、银行账号、销售方名称可以通过销售方纳税人识别号获取</p></blockquote><pre class="md-fences md-end-block" lang="json" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable">requestdatas</span><span class="cm-operator">=</span>[{</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"FPQQLSH"</span> : <span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"XSF_NSRSBH"</span> : <span class="cm-string">"销售方纳税人识别号"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"GMF_MC"</span> : <span class="cm-string">"购买方名称"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"JSHJ"</span> : <span class="cm-number">117</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"items"</span> : </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  [</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMMC"</span> : <span class="cm-string">"项目名称"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMSL"</span> : <span class="cm-number">1</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMJSHJ"</span> : <span class="cm-number">117</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"SL"</span> : <span class="cm-number">0.17</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  ]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}]</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 353px;"></div><div class="CodeMirror-gutters" style="display: none; height: 383px;"></div></div></div></pre><p>包含折扣行开票样例</p><blockquote><p>包含折扣行的单据需要增加以下信息
 FPHXZ：发票行性质
 HH：行号
 ZKHHH：折扣行行号
 <font color="red">折扣行上规则型号、单位、数量、单价 不用设值。折扣行的项目名称必须与被折扣行一样。被折扣行记录对应折扣行行号 。</font></p></blockquote><pre class="md-fences md-end-block" lang="json" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable">requestdatas</span><span class="cm-operator">=</span>[{</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"FPQQLSH"</span> : <span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"XSF_NSRSBH"</span> : <span class="cm-string">"销售方纳税人识别号"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"GMF_MC"</span> : <span class="cm-string">"购买方名称"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"JSHJ"</span> : <span class="cm-number">799</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"items"</span> : </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  [</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp;<span class="cm-string cm-property">"FPHXZ"</span> : <span class="cm-number">2</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMMC"</span> : <span class="cm-string">"项目名称"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMSL"</span> : <span class="cm-number">1</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMJSHJ"</span> : <span class="cm-number">899</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"SL"</span> : <span class="cm-number">0.17</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"HH"</span>:<span class="cm-string">"1"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"ZKHHH"</span>:<span class="cm-string">"2"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp;  },</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"FPHXZ"</span> : <span class="cm-number">1</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMMC"</span> : <span class="cm-string">"项目名称"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMJSHJ"</span> : <span class="cm-operator">-</span><span class="cm-number">100</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"SL"</span> : <span class="cm-number">0.17</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"HH"</span>:<span class="cm-string">"2"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  ]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}]</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 583px;"></div><div class="CodeMirror-gutters" style="display: none; height: 613px;"></div></div></div></pre><hr /><h3><a name='header-n1365' class='md-header-anchor '></a>返回结果说明</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >code</td><td>String</td><td style='text-align:left;' >状态码</td><td style='text-align:left;' ><a href='#header-n2262'>详见状态码说明</a></td></tr><tr><td style='text-align:left;' >msg</td><td>String</td><td style='text-align:left;' >信息说明</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >datas</td><td>JSONArray</td><td style='text-align:left;' >拆分结果数据</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><h4><a name='header-n1388' class='md-header-anchor '></a>返回样例</h4><pre class="md-fences md-end-block" lang="json" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">{</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"code"</span>: <span class="cm-string">"0000"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"msg"</span>: <span class="cm-string">"success"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"datas"</span>: [</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"bmbBbh"</span>: <span class="cm-string">"13.0"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"bz"</span>: <span class="cm-string">"BZSHY"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"corpId"</span>: <span class="cm-string">"9bf8bdc0-0647-4863-8c04-4c24c3487827"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"fhr"</span>: <span class="cm-string">"FHR"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"fpjz"</span>: <span class="cm-string">"0"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"fplx"</span>: <span class="cm-string">"1"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"fpqqlsh"</span>: <span class="cm-string">"shy100000000000006"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"fpzt"</span>: <span class="cm-string">"2"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"gmfDzdh"</span>: <span class="cm-string">"address"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"gmfMc"</span>: <span class="cm-string">"shy00004"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"gmfNsrsbh"</span>: <span class="cm-string">"214356654322666"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"gmfYhzh"</span>: <span class="cm-string">"213456543233523"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"hjje"</span>: <span class="cm-number">30000</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"hjse"</span>: <span class="cm-number">5100</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"id"</span>: <span class="cm-number">957786</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"jshj"</span>: <span class="cm-number">35100</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"kplx"</span>: <span class="cm-number">0</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"kpr"</span>: <span class="cm-string">"KPR"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"lylx"</span>: <span class="cm-string">"1"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"orgId"</span>: <span class="cm-number">37</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"orgcode"</span>: <span class="cm-string">"HX"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"skr"</span>: <span class="cm-string">"SKR"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"splitInvoice"</span>: <span class="cm-atom">true</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"xsfDzdh"</span>: <span class="cm-string">"XSFDZDH"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"xsfMc"</span>: <span class="cm-string">"测试3"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"xsfNsrsbh"</span>: <span class="cm-string">"111222333456333"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"xsfYhzh"</span>: <span class="cm-string">"6217000010005805406"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"zdrq"</span>: <span class="cm-number">1505400195352</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"zsfs"</span>: <span class="cm-string">"0"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"items"</span>: [</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"dw"</span>: <span class="cm-string">"DW"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"fphxz"</span>: <span class="cm-number">0</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"ggxh"</span>: <span class="cm-string">"GGXH"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"hh"</span>: <span class="cm-string">"1"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"hid"</span>: <span class="cm-number">957786</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"id"</span>: <span class="cm-number">1330772</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"kce"</span>: <span class="cm-number">0</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"se"</span>: <span class="cm-number">5100</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"sl"</span>: <span class="cm-number">0.17</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"spbm"</span>: <span class="cm-string">"1060301010100000000"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"xmdj"</span>: <span class="cm-number">15000</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"xmhsdj"</span>: <span class="cm-number">17550</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"xmje"</span>: <span class="cm-number">30000</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"xmjshj"</span>: <span class="cm-number">35100</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"xmmc"</span>: <span class="cm-string">"JYZBSS"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"xmsl"</span>: <span class="cm-number">2</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"yhzcbs"</span>: <span class="cm-number">0</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"zkhhh"</span>: <span class="cm-string">""</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"zxbm"</span>: <span class="cm-string">"10"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  ]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 1388px;"></div><div class="CodeMirror-gutters" style="display: none; height: 1418px;"></div></div></div></pre><hr /><h2><a name='header-n1391' class='md-header-anchor '></a>3、开票状态查询服务</h2><h3><a name='header-n1392' class='md-header-anchor '></a>请求说明</h3><blockquote><p>URL:<code>https://&lt;HOST&gt;:&lt;PORT&gt;/invoiceclient-web/api/invoiceApply/queryInvoiceStatus?appid=XXXXX</code>
格式：application/x-www-form-urlencoded; charset=UTF-8
http请求方式：POST
编码类型：UTF-8</p></blockquote><hr /><h3><a name='header-n1400' class='md-header-anchor '></a>请求头参数</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th style='text-align:right;' >类型</th><th style='text-align:center;' >是否必填</th><th>描述</th></tr></thead><tbody><tr><td style='text-align:left;' >sign</td><td style='text-align:right;' >String</td><td style='text-align:center;' >是</td><td>请求签名信息</td></tr></tbody></table></figure></blockquote><blockquote><p>JWT签名说明详见 <a href='https://jwt.io/' target='_blank' class='url'>https://jwt.io/</a>，各类编程语言参考官网的支持列表。
一个JWT实际上就是一个字符串，它由三部分组成，头部、载荷与签名。
<strong>注意事项</strong><font color ="red">
1、签名使用的密钥必须必须与平台appid注册的一致</p></blockquote><hr /><h3><a name='header-n1420' class='md-header-anchor '></a>请求体参数</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >fpqqlsh</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><hr /><h4><a name='header-n1440' class='md-header-anchor '></a>请求样例</h4><blockquote><p>表单参数如下
<code>fpqqlsh=12345678901234567890</code></p></blockquote><hr /><h3><a name='header-n1446' class='md-header-anchor '></a>返回结果说明</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >fpqqlsh</td><td>String</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >code</td><td>String</td><td style='text-align:left;' >状态码</td><td style='text-align:left;' >0000-查询成功;1002-数据不存在;<a href='#header-n2262'>详见状态码说明</a></td></tr><tr><td style='text-align:left;' >msg</td><td>String</td><td style='text-align:left;' >信息说明</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >statuscode</td><td>String</td><td style='text-align:left;' >开票状态码</td><td style='text-align:left;' >1-待开票（需要开票员确认开票）;2-开票中;3-开票失败;4-开票成功</td></tr><tr><td style='text-align:left;' >status</td><td>String</td><td style='text-align:left;' >开票状态</td><td style='text-align:left;' >待开票;开票中;开票失败;开票成功</td></tr><tr><td style='text-align:left;' >errmsg</td><td>String</td><td style='text-align:left;' >开票失败明细</td><td style='text-align:left;' >开票状态为失败时，此处为明细信息</td></tr><tr><td style='text-align:left;' >data</td><td>String</td><td style='text-align:left;' >开票内容</td><td style='text-align:left;' ><a href='#header-n2285'>开票状态为开票成功时，返回开票信息，为JSONObject，信息格式与回调服务相同。</a></td></tr></tbody></table></figure></blockquote><h4><a name='header-n1489' class='md-header-anchor '></a>返回样例</h4><pre class="md-fences md-end-block" lang="json" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">样例1（开票中）</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp;<span class="cm-string cm-property">"fpqqlsh"</span>: <span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"code"</span>: <span class="cm-string">"0000"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp;<span class="cm-string cm-property">"msg"</span>: <span class="cm-string">"查询成功"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp;<span class="cm-string cm-property">"statuscode"</span>: <span class="cm-string">"1"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"status"</span>: <span class="cm-string">"待开票"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">样例2（开票失败）</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp;<span class="cm-string cm-property">"fpqqlsh"</span>: <span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"code"</span>: <span class="cm-string">"0000"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp;<span class="cm-string cm-property">"msg"</span>: <span class="cm-string">"查询成功"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp;<span class="cm-string cm-property">"statuscode"</span>: <span class="cm-string">"3"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"status"</span>: <span class="cm-string">"开票失败"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"errmsg"</span>:<span class="cm-string">"税控设备错误"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 422px;"></div><div class="CodeMirror-gutters" style="display: none; height: 452px;"></div></div></div></pre><hr /><h2><a name='header-n1492' class='md-header-anchor '></a>4、发票红冲请求服务</h2><h3><a name='header-n1493' class='md-header-anchor '></a>请求说明</h3><blockquote><p>URL: <code>https://&lt;HOST&gt;:&lt;PORT&gt;/invoiceclient-web/api/invoiceApply/red?appid=XXXXX</code>
格式：application/x-www-form-urlencoded; charset=UTF-8
http请求方式：POST
编码类型：UTF-8
<font color="red"><strong>每次请求的数据不能超过10张单据</strong></font></p></blockquote><hr /><h3><a name='header-n1502' class='md-header-anchor '></a>请求头参数</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th style='text-align:right;' >类型</th><th style='text-align:center;' >是否必填</th><th>描述</th></tr></thead><tbody><tr><td style='text-align:left;' >sign</td><td style='text-align:right;' >String</td><td style='text-align:center;' >是</td><td>请求签名信息</td></tr></tbody></table></figure></blockquote><blockquote><p>JWT签名说明详见 <a href='https://jwt.io/' target='_blank' class='url'>https://jwt.io/</a>，各类编程语言参考官网的支持列表。
一个JWT实际上就是一个字符串，它由三部分组成，头部、载荷与签名。
<strong>注意事项</strong><font color ="red">
1、签名使用的密钥必须必须与平台appid注册的一致
2、签名载荷（Payload）中必须包含属性requestdatas，它的值为表单参数requestdatas的MD5值
3、具体使用方式参考<a href='#header-n2562'>样例代码</a>示例</p></blockquote><hr /><h3><a name='header-n1524' class='md-header-anchor '></a>请求体参数</h3><h4><a name='header-n1525' class='md-header-anchor '></a>表单说明</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >requestdatas</td><td style='text-align:left;' ><a href='#header-n1557'>发票红冲参数</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >email</td><td style='text-align:left;' ><a href='#header-n662'>邮件推送配置(可选)</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >sms</td><td style='text-align:left;' ><a href='#header-n664'>短信推送配置(可选)</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >url</td><td style='text-align:left;' ><a href='#header-n691'>回调服务配置(可选)</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >autoAudit</td><td style='text-align:left;' >是否自动审核(可选)</td><td style='text-align:left;' >true:自动审核，false:不自动审核。<br>如果不传，代表false</td></tr><tr><td style='text-align:left;' >nc6x-ubl</td><td style='text-align:left;' >ncc友企联回调参数</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><h4><a name='header-n1557' class='md-header-anchor '></a>发票红冲参数</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">FPQQLSH</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' ><font color="red">注意不是蓝字的发票请求流水号，是本次发票红冲的请求流水号</td></tr><tr><td style='text-align:left;' ><font color="red">fpDm</td><td>String</td><td style='text-align:center;' >12</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >蓝字发票代码</td><td style='text-align:left;' >被红冲的发票代码</td></tr><tr><td style='text-align:left;' ><font color="red">fpHm</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >蓝字发票号码</td><td style='text-align:left;' >被红冲的发票号码</td></tr><tr><td style='text-align:left;' ><font color="blue">ORGCODE</td><td>String</td><td style='text-align:center;' >50</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >开票点编码</td><td style='text-align:left;' >如果一个税号对应多个开票点，此字段必输，用于确定唯一开票点</td></tr><tr><td style='text-align:left;' >KPR</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >开票人</td><td style='text-align:left;' >如果为空，获取发票平台配置的开票人</td></tr><tr><td style='text-align:left;' >SKR</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >收款人</td><td style='text-align:left;' >如果为空，获取发票平台配置的收款人</td></tr><tr><td style='text-align:left;' >FHR</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >复核人</td><td style='text-align:left;' >如果为空，获取发票平台配置的复核人</td></tr><tr><td style='text-align:left;' >hzxxbbh</td><td>String</td><td style='text-align:center;' >30</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >红字信息表编号</td><td style='text-align:left;' ><font color="red">专票红冲时必传</td></tr></tbody></table></figure></blockquote><h4><a name='header-n1632' class='md-header-anchor '></a>邮件推送配置</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">fpqqlsh</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >必须和上面的开票请求对应</td></tr><tr><td style='text-align:left;' ><font color="red">address</td><td>String</td><td style='text-align:center;' >500</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >接收地址</td><td style='text-align:left;' >接收地址，多个地址使用&quot;,&quot;分隔开</td></tr></tbody></table></figure></blockquote><h4><a name='header-n1634' class='md-header-anchor '></a>短信推送配置</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">fpqqlsh</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >必须和上面的开票请求对应</td></tr><tr><td style='text-align:left;' ><font color="red">address</td><td>String</td><td style='text-align:center;' >500</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >接收地址</td><td style='text-align:left;' >接收地址，多个地址使用&quot;,&quot;分隔开</td></tr></tbody></table></figure></blockquote><h4><a name='header-n1661' class='md-header-anchor '></a>回调服务配置</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">fpqqlsh</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >必须和上面的开票请求对应</td></tr><tr><td style='text-align:left;' ><font color="red">url</td><td>String</td><td style='text-align:center;' >500</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >回调url</td><td style='text-align:left;' >开票申请调用方配置回调url，当电子发票开具成功后，调用此服务，POST电子发票相关信息。信息包含：1、pdf版式文件2、发票数据、3、发票下载链接<font color="red">ncc通过友企联方案回调可不传此参数</td></tr><tr><td style='text-align:left;' >intf</td><td>String</td><td style='text-align:center;' >200</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >ncc回调接口名</td><td style='text-align:left;' >ncc通过友企联方案回调时必传</td></tr><tr><td style='text-align:left;' >method</td><td>String</td><td style='text-align:center;' >200</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >ncc回调方法名</td><td style='text-align:left;' >ncc通过友企联方案回调时必传</td></tr></tbody></table></figure></blockquote><hr /><h4><a name='header-n1730' class='md-header-anchor '></a>请求样例</h4><blockquote><p>表单参数如下</p></blockquote><pre class="md-fences md-end-block" lang="json" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable">requestdatas</span><span class="cm-operator">=</span>[</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"fpHm"</span>: <span class="cm-string">"03091804"</span>, </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"fpDm"</span>: <span class="cm-string">"000000000000"</span>, </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"FPQQLSH"</span>: <span class="cm-string">"test1101"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"hzxxbbh"</span>:<span class="cm-string">"1101081902045091"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">] </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">&amp;</span><span class="cm-variable">email</span><span class="cm-operator">=</span>[</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp;<span class="cm-string cm-property">"fpqqlsh"</span>:<span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"address"</span>: <span class="cm-string">"x1@yonyou.com,x2@yonyou.com"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }, </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp;<span class="cm-string cm-property">"fpqqlsh"</span>:<span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"address"</span>: <span class="cm-string">"x3@yonyou.com"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">&amp;</span><span class="cm-variable">sms</span><span class="cm-operator">=</span>[{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"fpqqlsh"</span>:<span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"address"</span>: <span class="cm-string">"13511111111,13511111112"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">&amp;</span><span class="cm-variable">url</span><span class="cm-operator">=</span>[{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"fpqqlsh"</span>:<span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"url"</span>: <span class="cm-string">"http://url.com/msg"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">&amp;</span><span class="cm-variable">nc6x</span><span class="cm-operator">-</span><span class="cm-variable">ubl</span><span class="cm-operator">=</span>[{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"fpqqlsh"</span>:<span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"method"</span>:<span class="cm-string">"queryUserPermAppPksOrCodes"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"intf"</span>:<span class="cm-string">"nccloud.pubitf.baseapp.apprbac.IAppAndOrgPermQueryPubService"</span> &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">&amp;</span><span class="cm-variable">autoAudit</span><span class="cm-operator">=</span><span class="cm-atom">true</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 744px;"></div><div class="CodeMirror-gutters" style="display: none; height: 774px;"></div></div></div></pre><hr /><h3><a name='header-n1736' class='md-header-anchor '></a>返回结果说明</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >code</td><td>String</td><td style='text-align:left;' >状态码</td><td style='text-align:left;' ><a href='#header-n2262'>详见状态码说明</a></td></tr><tr><td style='text-align:left;' >msg</td><td>String</td><td style='text-align:left;' >信息说明</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><h4><a name='header-n1754' class='md-header-anchor '></a>返回样例</h4><pre class="md-fences md-end-block" lang="json"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">{</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"code"</span>: <span class="cm-string">"0000"</span>, </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"msg"</span>: <span class="cm-string">"success"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 100px;"></div><div class="CodeMirror-gutters" style="display: none; height: 130px;"></div></div></div></pre><hr /><h2><a name='header-n1757' class='md-header-anchor '></a>5、开票申请审核通过</h2><blockquote><p>此服务与开票蓝票请求服务、发票红冲请求服务配合使用。对于autoAudit=false的开票请求，通过调用此服务驱动开票。autoAudit=true时，不用调用此服务。</p></blockquote><h3><a name='header-n1759' class='md-header-anchor '></a>请求说明</h3><blockquote><p>URL: <code>https://&lt;HOST&gt;:&lt;PORT&gt;/invoiceclient-web/api/invoiceApply/issue?appid=XXXXX</code>
格式：application/x-www-form-urlencoded; charset=UTF-8 
http请求方式：POST 
编码类型：UTF-8 </p></blockquote><h3><a name='header-n1768' class='md-header-anchor '></a>请求头参数</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th style='text-align:right;' >类型</th><th style='text-align:center;' >是否必填</th><th>描述</th></tr></thead><tbody><tr><td style='text-align:left;' >sign</td><td style='text-align:right;' >String</td><td style='text-align:center;' >是</td><td>请求签名信息</td></tr></tbody></table></figure></blockquote><blockquote><p>JWT签名说明详见 <a href='https://jwt.io/' target='_blank' class='url'>https://jwt.io/</a>，各类编程语言参考官网的支持列表。
一个JWT实际上就是一个字符串，它由三部分组成，头部、载荷与签名。
<strong>注意事项</strong><font color ="red">
1、签名使用的密钥必须必须与平台appid注册的一致
2、签名载荷（Payload）中必须包含属性requestdatas，它的值为表单参数requestdatas的MD5值
3、具体使用方式参考<a href='#header-n2562'>样例代码</a>示例</p></blockquote><h3><a name='header-n1789' class='md-header-anchor '></a>请求体参数</h3><h4><a name='header-n1790' class='md-header-anchor '></a>表单说明</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >requestdatas</td><td style='text-align:left;' ><a href='#header-n1792'>发票开具动作参数</a></td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><h4><a name='header-n1792' class='md-header-anchor '></a>发票开具动作参数</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">FPQQLSH</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="red">XSF_NSRSBH</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >销售方纳税人识别号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="red">JSHJ</td><td>double</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >价税合计</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><h4><a name='header-n1836' class='md-header-anchor '></a>请求样例</h4><pre class="md-fences md-end-block" lang="json"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable">requestdatas</span><span class="cm-operator">=</span>[{</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"FPQQLSH"</span> : <span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"XSF_NSRSBH"</span> : <span class="cm-string">"销售方纳税人识别号"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"JSHJ"</span>:<span class="cm-number">1234</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}]</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 123px;"></div><div class="CodeMirror-gutters" style="display: none; height: 153px;"></div></div></div></pre><h3><a name='header-n1838' class='md-header-anchor '></a>返回结果说明</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >code</td><td>String</td><td style='text-align:left;' >状态码</td><td style='text-align:left;' ><a href='#header-n2262'>详见状态码说明</a></td></tr><tr><td style='text-align:left;' >msg</td><td>String</td><td style='text-align:left;' >信息说明</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><h4><a name='header-n1857' class='md-header-anchor '></a>返回样例</h4><pre class="md-fences md-end-block" lang="json"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">{</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"code"</span>: <span class="cm-string">"0000"</span>, </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"msg"</span>: <span class="cm-string">"success"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 100px;"></div><div class="CodeMirror-gutters" style="display: none; height: 130px;"></div></div></div></pre><hr /><h2><a name='header-n1860' class='md-header-anchor '></a>6、电子发票部分红冲</h2><h3><a name='header-n1861' class='md-header-anchor '></a>请求说明</h3><blockquote><p>URL:<code>https://&lt;HOST&gt;:&lt;PORT&gt;/invoiceclient-web/api/invoiceApply/part-red?appid=XXXXX</code>
格式：application/x-www-form-urlencoded; charset=UTF-8
http请求方式：POST
编码类型：UTF-8
<font color="red"><strong>每次请求的数据不能超过10张单据<br>此接口只能用来开具蓝票</strong></font></p></blockquote><hr /><h3><a name='header-n1870' class='md-header-anchor '></a>请求头参数</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th style='text-align:right;' >类型</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >描述</th><th>备注</th></tr></thead><tbody><tr><td style='text-align:left;' >sign</td><td style='text-align:right;' >String</td><td style='text-align:center;' >是</td><td style='text-align:center;' >请求签名信息</td><td>使用JWT生成token</td></tr></tbody></table></figure></blockquote><blockquote><p>JWT签名说明详见 <a href='https://jwt.io/' target='_blank' class='url'>https://jwt.io/</a>，各类编程语言参考官网的支持列表。
一个JWT实际上就是一个字符串，它由三部分组成，头部、载荷与签名。
<strong>注意事项</strong><font color ="red">
1、签名使用的密钥必须必须与平台appid注册的一致
2、签名载荷（Payload）中必须包含属性requestdatas，它的值为表单参数requestdatas的MD5值
3、具体使用方式参考<a href='#header-n2562'>样例代码</a>示例</p></blockquote><hr /><h3><a name='header-n1894' class='md-header-anchor '></a>请求体参数</h3><h4><a name='header-n1895' class='md-header-anchor '></a>表单说明</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >requestdatas</td><td style='text-align:left;' >开票申请发票信息，包含<a href='#header-n285'>发票头</a>、<a href='#header-n497'>发票明细</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >email</td><td style='text-align:left;' ><a href='#header-n662'>邮件推送配置(可选)</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >sms</td><td style='text-align:left;' ><a href='#header-n664'>短信推送配置(可选)</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >url</td><td style='text-align:left;' ><a href='#header-n691'>回调服务配置(可选)</a></td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >autoAudit</td><td style='text-align:left;' >是否自动审核(可选)</td><td style='text-align:left;' >true:自动审核，即不需要人工在发票平台确认开票，直接进行开票 false:不自动审核，即需要人工确认<br>如果不传，代表true</td></tr><tr><td style='text-align:left;' >nc6x-ubl</td><td style='text-align:left;' >ncc友企联回调参数</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><h4><a name='header-n1926' class='md-header-anchor '></a>发票头</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">FPQQLSH</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' ><font color="red">注意不是蓝字的发票请求流水号，是本次发票红冲的请求流水号</td></tr><tr><td style='text-align:left;' ><font color="red">fpDm</td><td>String</td><td style='text-align:center;' >12</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >蓝字发票代码</td><td style='text-align:left;' >被红冲的发票代码</td></tr><tr><td style='text-align:left;' ><font color="red">fpHm</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >蓝字发票号码</td><td style='text-align:left;' >被红冲的发票号码</td></tr><tr><td style='text-align:left;' >KPR</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >开票人</td><td style='text-align:left;' >如果为空，获取发票平台配置的开票人</td></tr><tr><td style='text-align:left;' >SKR</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >收款人</td><td style='text-align:left;' >如果为空，获取发票平台配置的收款人</td></tr><tr><td style='text-align:left;' >FHR</td><td>String</td><td style='text-align:center;' >8</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >复核人</td><td style='text-align:left;' >如果为空，获取发票平台配置的复核人</td></tr><tr><td style='text-align:left;' ><font color="red">JSHJ</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >价税合计</td><td style='text-align:left;' >两位小数。明细价税合计之和必须与总的价税合计一致；价税合计小于0，并且绝对值不能大于蓝票</td></tr><tr><td style='text-align:left;' >HJJE</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >合计金额</td><td style='text-align:left;' >两位小数。为空时，根据明细项目进行合计。合计金额小于0，并且绝对值不能大于蓝票</td></tr><tr><td style='text-align:left;' >HJSE</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >合计税额</td><td style='text-align:left;' >两位小数。为空时，根据明细项目进行合计。</td></tr><tr><td style='text-align:left;' >LYID</td><td>String</td><td style='text-align:center;' >100</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >请求来源唯一标识</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="blue">BMB_BBH</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >否</td><td style='text-align:center;' >13.0</td><td style='text-align:left;' >编码版本号</td><td style='text-align:left;' >增加商品编码功能后，税局下载的商品编码表版本</td></tr><tr><td style='text-align:left;' ><font color="blue">ORGCODE</td><td>String</td><td style='text-align:center;' >50</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >开票点编码</td><td style='text-align:left;' >如果一个税号对应多个开票点，此字段必输，用于确定唯一开票点</td></tr><tr><td style='text-align:left;' >hzxxbbh</td><td>String</td><td style='text-align:center;' >30</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >红字信息表编号</td><td style='text-align:left;' ><font color="red">专票红冲时必传</td></tr></tbody></table></figure></blockquote><h4><a name='header-n2041' class='md-header-anchor '></a>发票明细</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">XMMC</td><td>String</td><td style='text-align:center;' >90</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目名称</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' ><font color="red">XMBM</td><td>String</td><td style='text-align:center;' >90</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目编码</td><td style='text-align:left;' >如果项目名称为空，会根据项目编码匹配云平台的商品档案</td></tr><tr><td style='text-align:left;' >GGXH</td><td>String</td><td style='text-align:center;' >40</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >规格型号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >DW</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >单位</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >XMSL</td><td>Double</td><td style='text-align:center;' >15,6</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目数量</td><td style='text-align:left;' >项目数量必须小于0</td></tr><tr><td style='text-align:left;' >XMDJ</td><td>Double</td><td style='text-align:center;' >15,6</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目单价</td><td style='text-align:left;' >项目单价为空时，根据项目金额反算。不为空时不进行计算；</td></tr><tr><td style='text-align:left;' >XMJE</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目金额</td><td style='text-align:left;' >项目金额为空，根据项目价税合计反算。不为空时不进行计算；金额必须小于0</td></tr><tr><td style='text-align:left;' ><font color="red">XMJSHJ</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >项目价税合计</td><td style='text-align:left;' >价税合计必须小于0</td></tr><tr><td style='text-align:left;' ><font color="red">SL</td><td>Double</td><td style='text-align:center;' >6,6</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >税率</td><td style='text-align:left;' >6 位小数，例 17%为 0.17</td></tr><tr><td style='text-align:left;' >SE</td><td>Double</td><td style='text-align:center;' >15,2</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >税额</td><td style='text-align:left;' >税额为空，根据价税合计反算。不为空时不进行计算。</td></tr><tr><td style='text-align:left;' >HH</td><td>string</td><td style='text-align:center;' >60</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >行号</td><td style='text-align:left;' >有折扣时需要必输</td></tr><tr><td style='text-align:left;' ><font color="red">SPBM</td><td>string</td><td style='text-align:center;' >19</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >商品编码</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><hr /><h4><a name='header-n2149' class='md-header-anchor '></a>邮件推送配置</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">fpqqlsh</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >必须和上面的开票请求对应</td></tr><tr><td style='text-align:left;' ><font color="red">address</td><td>String</td><td style='text-align:center;' >500</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >接收地址</td><td style='text-align:left;' >接收地址，多个地址使用&quot;,&quot;分隔开</td></tr></tbody></table></figure></blockquote><h4><a name='header-n2176' class='md-header-anchor '></a>短信推送配置</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">fpqqlsh</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >必须和上面的开票请求对应</td></tr><tr><td style='text-align:left;' ><font color="red">address</td><td>String</td><td style='text-align:center;' >500</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >接收地址</td><td style='text-align:left;' >接收地址，多个地址使用&quot;,&quot;分隔开</td></tr></tbody></table></figure></blockquote><h4><a name='header-n2203' class='md-header-anchor '></a>回调服务配置</h4><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:center;' >长度</th><th style='text-align:center;' >是否必填</th><th style='text-align:center;' >默认值</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' ><font color="red">fpqqlsh</td><td>String</td><td style='text-align:center;' >20</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >必须和上面的开票请求对应</td></tr><tr><td style='text-align:left;' ><font color="red">url</td><td>String</td><td style='text-align:center;' >500</td><td style='text-align:center;' >是</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >回调url</td><td style='text-align:left;' >开票申请调用方配置回调url，当电子发票开具成功后，调用此服务，POST电子发票相关信息。信息包含：1、pdf版式文件2、发票数据、3、发票下载链接<font color="red">ncc通过友企联方案回调可不传此参数</td></tr><tr><td style='text-align:left;' >intf</td><td>String</td><td style='text-align:center;' >200</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >ncc回调接口名</td><td style='text-align:left;' >ncc通过友企联方案回调时必传</td></tr><tr><td style='text-align:left;' >method</td><td>String</td><td style='text-align:center;' >200</td><td style='text-align:center;' >否</td><td style='text-align:center;' >&nbsp;</td><td style='text-align:left;' >ncc回调方法名</td><td style='text-align:left;' >ncc通过友企联方案回调时必传</td></tr></tbody></table></figure></blockquote><hr /><h4><a name='header-n2247' class='md-header-anchor '></a>请求样例</h4><blockquote><p>表单参数如下</p></blockquote><pre class="md-fences md-end-block" lang="json" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable">requestdatas</span><span class="cm-operator">=</span>[ {</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"FPQQLSH"</span> : <span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"fpHm"</span>: <span class="cm-string">"03091804"</span>, </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"fpDm"</span>: <span class="cm-string">"000000000000"</span>, </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"KPR"</span> : <span class="cm-string">"开票人"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"SKR"</span> : <span class="cm-string">"收款人"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"FHR"</span> : <span class="cm-string">"复核人"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"JSHJ"</span> : <span class="cm-string">"价税合计"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"HJJE"</span> : <span class="cm-string">"合计金额"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"HJSE"</span> : <span class="cm-string">"合计税额"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"hzxxbbh"</span>:<span class="cm-string">"1101081902045091"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"items"</span> : [{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMMC"</span> : <span class="cm-string">"项目名称"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"GGXH"</span> : <span class="cm-string">"规格型号"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"DW"</span> : <span class="cm-string">"单位"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMSL"</span> : <span class="cm-string">"项目数量"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMDJ"</span> : <span class="cm-string">"项目单价"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMJE"</span> : <span class="cm-string">"项目金额"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMJSHJ"</span> : <span class="cm-string">"项目价税合计"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"SL"</span> : <span class="cm-string">"税率"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"SE"</span> : <span class="cm-string">"税额"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"HH"</span>:<span class="cm-string">"行号"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"SPBM"</span>:<span class="cm-string">"商品编码"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">&amp;</span><span class="cm-variable">email</span><span class="cm-operator">=</span>[</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp;<span class="cm-string cm-property">"fpqqlsh"</span>:<span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"address"</span>: <span class="cm-string">"x1@yonyou.com,x2@yonyou.com"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }, </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp;<span class="cm-string cm-property">"fpqqlsh"</span>:<span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"address"</span>: <span class="cm-string">"x3@yonyou.com"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">&amp;</span><span class="cm-variable">sms</span><span class="cm-operator">=</span>[{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"fpqqlsh"</span>:<span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"address"</span>: <span class="cm-string">"13511111111,13511111112"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">&amp;</span><span class="cm-variable">url</span><span class="cm-operator">=</span>[{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"fpqqlsh"</span>:<span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"url"</span>: <span class="cm-string">"http://url.com/msg"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">&amp;</span><span class="cm-variable">nc6x</span><span class="cm-operator">-</span><span class="cm-variable">ubl</span><span class="cm-operator">=</span>[{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"fpqqlsh"</span>:<span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"method"</span>:<span class="cm-string">"queryUserPermAppPksOrCodes"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"intf"</span>:<span class="cm-string">"nccloud.pubitf.baseapp.apprbac.IAppAndOrgPermQueryPubService"</span> &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">&amp;</span><span class="cm-variable">autoAudit</span><span class="cm-operator">=</span><span class="cm-atom">true</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 1158px;"></div><div class="CodeMirror-gutters" style="display: none; height: 1188px;"></div></div></div></pre><p>普通开票最小参数样例</p><blockquote><p>销售方地址电话、银行账号、销售方名称可以通过销售方纳税人识别号获取</p></blockquote><pre class="md-fences md-end-block" lang="json" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-variable">requestdatas</span><span class="cm-operator">=</span>[{</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"FPQQLSH"</span> : <span class="cm-string">"12345678901234567890"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"fpHm"</span>: <span class="cm-string">"03091804"</span>, </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"fpDm"</span>: <span class="cm-string">"000000000000"</span>, </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"JSHJ"</span> : <span class="cm-operator">-</span><span class="cm-number">117</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"items"</span> : </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  [</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMMC"</span> : <span class="cm-string">"项目名称"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"SPBM"</span> : <span class="cm-string">"1010101020000000000"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"XMJSHJ"</span> : <span class="cm-operator">-</span><span class="cm-number">117</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string cm-property">"SL"</span> : <span class="cm-number">0.17</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp;  ]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}]</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 353px;"></div><div class="CodeMirror-gutters" style="display: none; height: 383px;"></div></div></div></pre><p>&nbsp;</p><hr /><h2><a name='header-n2261' class='md-header-anchor '></a>附录</h2><h3><a name='header-n2262' class='md-header-anchor '></a>状态码</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >状态码</th><th>说明</th></tr></thead><tbody><tr><td style='text-align:left;' >0000</td><td>操作成功</td></tr><tr><td style='text-align:left;' >1001</td><td>数据不合法，传入参数</td></tr><tr><td style='text-align:left;' >1002</td><td>数据不存在</td></tr><tr><td style='text-align:left;' >9999</td><td>未知错误</td></tr></tbody></table></figure></blockquote><hr /><h3><a name='header-n2281' class='md-header-anchor '></a>NCC友企联回调数据样例</h3><pre class="md-fences md-end-block" lang="json"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">{</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"method"</span>: <span class="cm-string">"queryUserPermAppPksOrCodes"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"interface"</span>: <span class="cm-string">"nccloud.pubitf.baseapp.apprbac.IAppAndOrgPermQueryPubService"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"serviceMethodArgInfo"</span>: [</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"agg"</span>: <span class="cm-atom">false</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"argType"</span>: <span class="cm-string">"java.lang.String"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"isArray"</span>: <span class="cm-atom">false</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"isPrimitive"</span>: <span class="cm-atom">false</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-string cm-property">"argValue"</span>: <span class="cm-string">"{\"data\":\"{\"ewm\":\"01,10,68974368,010011652011,20160906,,12345678901234567890,\",\"fhr\":\"ljm111\",\"fpDm\":\"010011652011\",\"fpHm\":\"68974368\",\"fpMw\":\"&lt;-&lt;&gt;48938&lt;4+&lt;14&gt;735+&lt;2554*8-1-&lt;+15&lt;*026+848686/2/3//0&gt;+*&gt;&gt;&gt;356*&lt;757/47&gt;90+&lt;25&lt;&lt;3575**934&lt;+15&lt;*026+848686--57\",\"fplx\":\"1\",\"fpjz\":\"0\",\"fpqqlsh\":\"12345677901234567897\",\"bmbBbh\":\"10.0\",\"gmfMc\":\"测试开票用户\",\"hjje\":100.00,\"hjse\":17.00,\"jqbh\":\"111111111111\",\"jshj\":117,\"jym\":\"12345678901234567890\",\"kplx\":0,\"kpr\":\"2\",\"kprq\":\"20160906202718\",\"skr\":\"ljm111\",\"corpId\":\"5bdfc3b7-fd88-4947-8a50-2474b97d7eef\",\"orgId\":\"12010101\",\"xsfDzdh\":\"北京市海淀区 110\",\"xsfMc\":\"北京\",\"xsfNsrsbh\":\"111112222233333\",\"xsfYhzh\":\"1 1\",\"yfpDm\":\"\",\"yfpHm\":\"\",\"items\":[{\"fphxz\":0,\"se\":17.00,\"sl\":0.17,\"xmdj\":100.000000,\"xmje\":100.00,\"xmjshj\":117,\"xmmc\":\"项目名称\",\"spbm\":\"3070101000000000000\",\"zxbm\":\"10\",\"yhzcbs\":0,\"xmsl\":1}]}\",  \"code\":\"0000\", &nbsp; \"msg\": \"开票成功\", \"fpqqlsh\": \"12345677901234567897\", \"pdf\": \"pdf文件流\",\"shareurl\": \"http://192.168.52.101/invoiceent-web/s/ab799b5413221cc19088a465d62f8c4f\",\"sharecode\": \"E3N2\" }"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span>]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 675px;"></div><div class="CodeMirror-gutters" style="display: none; height: 705px;"></div></div></div></pre><h3><a name='header-n2283' class='md-header-anchor '></a>常规回调数据样例</h3><pre class="md-fences md-end-block" lang="json"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"data"</span>: <span class="cm-string">"{\"ewm\":\"01,10,68974368,010011652011,20160906,,12345678901234567890,\",\"zdybz\":\"自定义备注\",\"fhr\":\"ljm111\",\"fpDm\":\"010011652011\",\"fpHm\":\"68974368\",\"fpMw\":\"&lt;-&lt;&gt;48938&lt;4+&lt;14&gt;735+&lt;2554*8-1-&lt;+15&lt;*026+848686/2/3//0&gt;+*&gt;&gt;&gt;356*&lt;757/47&gt;90+&lt;25&lt;&lt;3575**934&lt;+15&lt;*026+848686--57\",\"fplx\":\"1\",\"fpjz\":\"0\",\"fpqqlsh\":\"12345677901234567897\",\"bmbBbh\":\"10.0\",\"gmfMc\":\"测试开票用户\",\"hjje\":100.00,\"hjse\":17.00,\"jqbh\":\"111111111111\",\"jshj\":117,\"jym\":\"12345678901234567890\",\"kplx\":0,\"kpr\":\"2\",\"kprq\":\"20160906202718\",\"skr\":\"ljm111\",\"corpId\":\"5bdfc3b7-fd88-4947-8a50-2474b97d7eef\",\"orgId\":\"12010101\",\"xsfDzdh\":\"北京市海淀区 110\",\"xsfMc\":\"北京\",\"xsfNsrsbh\":\"111112222233333\",\"xsfYhzh\":\"1 1\",\"yfpDm\":\"\",\"yfpHm\":\"\",\"items\":[{\"fphxz\":0,\"se\":17.00,\"sl\":0.17,\"xmdj\":100.000000,\"xmje\":100.00,\"xmjshj\":117,\"xmmc\":\"项目名称\",\"spbm\":\"3070101000000000000\",\"zxbm\":\"10\",\"yhzcbs\":0,\"xmsl\":1}]}"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"code"</span>: <span class="cm-string">"0000"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"msg"</span>: <span class="cm-string">"开票成功"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"fpqqlsh"</span>: <span class="cm-string">"12345677901234567897"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"pdf"</span>: <span class="cm-string">"pdf文件流"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"shareurl"</span>: <span class="cm-string">"http://192.168.52.101/invoiceent-web/s/ab799b5413221cc19088a465d62f8c4f"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string cm-property">"sharecode"</span>: <span class="cm-string">"E3N2"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 560px;"></div><div class="CodeMirror-gutters" style="display: none; height: 590px;"></div></div></div></pre><h3><a name='header-n2285' class='md-header-anchor '></a>回调服务参数</h3><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >code</td><td>String</td><td style='text-align:left;' >开票信息码</td><td style='text-align:left;' >0000代表开票成功</td></tr><tr><td style='text-align:left;' >msg</td><td>String</td><td style='text-align:left;' >开票失败信息</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >fpqqlsh</td><td>String</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >pdf</td><td>String</td><td style='text-align:left;' >pdf文件</td><td style='text-align:left;' >使用Base64解码为二进制流，可以保存为pdf文件</td></tr><tr><td style='text-align:left;' >shareurl</td><td>String</td><td style='text-align:left;' >发票提取url</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >sharecode</td><td>String</td><td style='text-align:left;' >发票提取码</td><td style='text-align:left;' >与提取url配合使用</td></tr><tr><td style='text-align:left;' >data</td><td>String</td><td style='text-align:left;' >发票详细信息</td><td style='text-align:left;' ><a href='#header-n2328'>回调服务发票详细信息</a></td></tr></tbody></table></figure></blockquote><h3><a name='header-n2328' class='md-header-anchor '></a>回调服务发票详细信息</h3><ul><li>发票头数据</li></ul><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >fpqqlsh</td><td>String</td><td style='text-align:left;' >发票请求流水号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >jqbh</td><td>String</td><td style='text-align:left;' >机器编号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >fpHm</td><td>String</td><td style='text-align:left;' >发票号码</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >fpDm</td><td>String</td><td style='text-align:left;' >发票代码</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >fpMw</td><td>String</td><td style='text-align:left;' >发票密文</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >jym</td><td>String</td><td style='text-align:left;' >校验码</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >kprq</td><td>String</td><td style='text-align:left;' >开票日期</td><td style='text-align:left;' >格式YYYYMMDDHHMMSS</td></tr><tr><td style='text-align:left;' >gmfDzdh</td><td>String</td><td style='text-align:left;' >购买方地址电话</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >gmfMc</td><td>String</td><td style='text-align:left;' >购买方名称</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >gmfNsrsbh</td><td>String</td><td style='text-align:left;' >购买方纳税人识别号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >gmfYhzh</td><td>String</td><td style='text-align:left;' >购买方银行账户</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >xsfDzdh</td><td>String</td><td style='text-align:left;' >销售方地址电话</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >xsfMc</td><td>String</td><td style='text-align:left;' >销售方名称</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >xsfNsrsbh</td><td>String</td><td style='text-align:left;' >销售纳税人识别号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >xsfYhzh</td><td>String</td><td style='text-align:left;' >销售方银行账户</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >yfpDm</td><td>String</td><td style='text-align:left;' >原发票代码</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >yfpHm</td><td>String</td><td style='text-align:left;' >原发票号码</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >hjje</td><td>double</td><td style='text-align:left;' >合计金额</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >hjse</td><td>double</td><td style='text-align:left;' >合计税额</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >jshj</td><td>double</td><td style='text-align:left;' >价税合计</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >kpr</td><td>String</td><td style='text-align:left;' >开票人</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >fhr</td><td>String</td><td style='text-align:left;' >复核人</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >skr</td><td>String</td><td style='text-align:left;' >收款人</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >bz</td><td>String</td><td style='text-align:left;' >备注</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >zfbz</td><td>String</td><td style='text-align:left;' >作废标志</td><td style='text-align:left;' >Y:是；N否</td></tr><tr><td style='text-align:left;' >bred</td><td>String</td><td style='text-align:left;' >是否红冲</td><td style='text-align:left;' >Y:是；N否</td></tr><tr><td style='text-align:left;' >zdybz</td><td>String</td><td style='text-align:left;' >自定义备注</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >items</td><td>Object</td><td style='text-align:left;' >发票明细</td><td style='text-align:left;' >发票明细数据</td></tr></tbody></table></figure></blockquote><ul><li>发票明细数据</li></ul><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >xmmc</td><td>String</td><td style='text-align:left;' >项目名称</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >ggxh</td><td>String</td><td style='text-align:left;' >规格型号</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >dw</td><td>String</td><td style='text-align:left;' >单位</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >xmsl</td><td>doube</td><td style='text-align:left;' >项目数量</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >xmdj</td><td>doube</td><td style='text-align:left;' >项目单价</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >xmje</td><td>doube</td><td style='text-align:left;' >项目金额</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >xmjshj</td><td>String</td><td style='text-align:left;' >项目价税合计</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >sl</td><td>String</td><td style='text-align:left;' >税率</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >se</td><td>String</td><td style='text-align:left;' >税额</td><td style='text-align:left;' >&nbsp;</td></tr><tr><td style='text-align:left;' >hh</td><td>string</td><td style='text-align:left;' >行号</td><td style='text-align:left;' >&nbsp;</td></tr></tbody></table></figure></blockquote><h3><a name='header-n2541' class='md-header-anchor '></a>回调服务返回结果</h3><p>回调服务对回调信息处理后，需要返回处理结果信息。
返回参数约定如下：</p><blockquote><figure><table><thead><tr><th style='text-align:left;' >参数</th><th>类型</th><th style='text-align:left;' >描述</th><th style='text-align:left;' >说明</th></tr></thead><tbody><tr><td style='text-align:left;' >code</td><td>String</td><td style='text-align:left;' >处理结果编码</td><td style='text-align:left;' >0000：表示回调服务处理成功</td></tr><tr><td style='text-align:left;' >msg</td><td>String</td><td style='text-align:left;' >处理结果明细信息</td><td style='text-align:left;' >回调处理的明细信息。如果存在错误，此处为错误信息</td></tr></tbody></table></figure></blockquote><h3><a name='header-n2562' class='md-header-anchor '></a>样例代码</h3><blockquote><p>样例代码演示的是开票服务的调用，请根据实际应用场景参考使用
样例代码获取可以发邮件至<a href='mailto:wangweir@yonyou.com' target='_blank' class='url'>wangweir@yonyou.com</a>，注意标明具体编程语言</p></blockquote><h4><a name='header-n2567' class='md-header-anchor '></a><strong>Java（适用于JDK1.6及其更高版本）</strong></h4><h5><a name='header-n2568' class='md-header-anchor '></a><strong>Maven配置文件依赖</strong></h5><p>依赖配置如下</p><pre class="md-fences md-end-block" lang="xml" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">&lt;!-- httpclient，发送HTTP请求 --&gt;</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span>org.apache.httpcomponents<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span>httpclient<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span>4.5<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">&lt;!-- gson，json转换工具 --&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span>com.google.code.gson<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span>gson<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span>2.7<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">&lt;!-- jjwt，Java Web Token签名工具包 --&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span>io.jsonwebtoken<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span>jjwt<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span>0.6.0<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 422px;"></div><div class="CodeMirror-gutters" style="display: none; height: 452px;"></div></div></div></pre><h5><a name='header-n2572' class='md-header-anchor '></a><strong>API调用代码</strong></h5><pre class="md-fences md-end-block" lang="java" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">/**</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">com</span>.<span class="cm-variable">google</span>.<span class="cm-variable">gson</span>.<span class="cm-variable">GsonBuilder</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">com</span>.<span class="cm-variable">yonyou</span>.<span class="cm-variable">einvoice</span>.<span class="cm-variable">einvoiceApply</span>.<span class="cm-variable">JwtParamBuilder</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">io</span>.<span class="cm-variable">jsonwebtoken</span>.<span class="cm-variable">Jwts</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">io</span>.<span class="cm-variable">jsonwebtoken</span>.<span class="cm-variable">SignatureAlgorithm</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">io</span>.<span class="cm-variable">jsonwebtoken</span>.<span class="cm-variable">impl</span>.<span class="cm-variable">compression</span>.<span class="cm-variable">CompressionCodecs</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">HttpEntity</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">HttpResponse</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">NameValuePair</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">client</span>.<span class="cm-variable">HttpClient</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">client</span>.<span class="cm-variable">entity</span>.<span class="cm-variable">UrlEncodedFormEntity</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">client</span>.<span class="cm-variable">methods</span>.<span class="cm-variable">HttpPost</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">conn</span>.<span class="cm-variable">ssl</span>.<span class="cm-variable">SSLConnectionSocketFactory</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">conn</span>.<span class="cm-variable">ssl</span>.<span class="cm-variable">TrustStrategy</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">impl</span>.<span class="cm-variable">client</span>.<span class="cm-variable">CloseableHttpClient</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">impl</span>.<span class="cm-variable">client</span>.<span class="cm-variable">HttpClients</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">message</span>.<span class="cm-variable">BasicNameValuePair</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">ssl</span>.<span class="cm-variable">SSLContextBuilder</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">util</span>.<span class="cm-variable">EntityUtils</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">javax</span>.<span class="cm-variable">net</span>.<span class="cm-variable">ssl</span>.<span class="cm-variable">HostnameVerifier</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">javax</span>.<span class="cm-variable">net</span>.<span class="cm-variable">ssl</span>.<span class="cm-variable">SSLContext</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">javax</span>.<span class="cm-variable">net</span>.<span class="cm-variable">ssl</span>.<span class="cm-variable">SSLSession</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">io</span>.<span class="cm-variable">FileInputStream</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">io</span>.<span class="cm-variable">IOException</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">io</span>.<span class="cm-variable">UnsupportedEncodingException</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">security</span>.<span class="cm-operator">*</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">security</span>.<span class="cm-variable">cert</span>.<span class="cm-variable">CertificateException</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">security</span>.<span class="cm-variable">interfaces</span>.<span class="cm-variable">RSAPrivateKey</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">util</span>.<span class="cm-operator">*</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">util</span>.<span class="cm-variable">Map</span>.<span class="cm-variable">Entry</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* @date 2018/5/25</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* 该样例代码为调用开蓝票接口代码，适用于JDK1.6及更高版本，jdk1.6版本需要对签名方法稍做修改，修改方法在签名方法内已经写明</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* 请求参数的注意事项也在参数构建的过程中写明，请详细阅读样例代码。</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">public</span> <span class="cm-keyword">class</span> <span class="cm-def">InsertWithArray</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">//测试环境有测试appid和证书，正式环境有正式appid和证书，请务必对应使用</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">//测试环境appid就用这个，正式环境需要替换成正式的</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">String</span> <span class="cm-variable">APPID</span> <span class="cm-operator">=</span> <span class="cm-string">"commontesterCA"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">//这个是测试环境的域名，正式环境为https://fapiao.yonyoucloud.com</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">String</span> <span class="cm-variable">DOMAIN</span> <span class="cm-operator">=</span> <span class="cm-string">"https://yesfp.yonyoucloud.com"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">String</span> <span class="cm-variable">URL</span> <span class="cm-operator">=</span> <span class="cm-variable">DOMAIN</span> <span class="cm-operator">+</span> <span class="cm-string">"/invoiceclient-web/api/invoiceApply/insertWithArray?appid="</span> <span class="cm-operator">+</span> <span class="cm-variable">APPID</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">//pro22.pfx为测试环境通讯证书，正式环境需要替换成正式的</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">String</span> <span class="cm-variable">KEYPATH</span> <span class="cm-operator">=</span> <span class="cm-string">"src/main/resources/certificate/pro22.pfx"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">//证书密码</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">String</span> <span class="cm-variable">PASSWORD</span> <span class="cm-operator">=</span> <span class="cm-string">"password"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">void</span> <span class="cm-variable">main</span>(<span class="cm-variable-3">String</span>[] <span class="cm-variable">args</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">try</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">new</span> <span class="cm-variable">InsertWithArray</span>().<span class="cm-variable">callInvoiceApply</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  } <span class="cm-keyword">catch</span> (<span class="cm-variable">Exception</span> <span class="cm-variable">e</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">e</span>.<span class="cm-variable">printStackTrace</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable">CloseableHttpClient</span> <span class="cm-variable">createSSLClientDefault</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">try</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">SSLContext</span> <span class="cm-variable">sslContext</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">SSLContextBuilder</span>().<span class="cm-variable">loadTrustMaterial</span>(<span class="cm-atom">null</span>, <span class="cm-keyword">new</span> <span class="cm-variable">TrustStrategy</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-meta">@Override</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable-3">boolean</span> <span class="cm-variable">isTrusted</span>(<span class="cm-variable">java</span>.<span class="cm-variable">security</span>.<span class="cm-variable">cert</span>.<span class="cm-variable">X509Certificate</span>[] <span class="cm-variable">chain</span>, <span class="cm-variable-3">String</span> <span class="cm-variable">authType</span>) <span class="cm-keyword">throws</span> <span class="cm-variable">CertificateException</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-atom">true</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }).<span class="cm-variable">build</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">SSLConnectionSocketFactory</span> <span class="cm-variable">sslsf</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">SSLConnectionSocketFactory</span>(<span class="cm-variable">sslContext</span>, <span class="cm-keyword">new</span> <span class="cm-variable">HostnameVerifier</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-meta">@Override</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable-3">boolean</span> <span class="cm-variable">verify</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">s</span>, <span class="cm-variable">SSLSession</span> <span class="cm-variable">sslSession</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-atom">true</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  });</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">HttpClients</span>.<span class="cm-variable">custom</span>().<span class="cm-variable">setSSLSocketFactory</span>(<span class="cm-variable">sslsf</span>).<span class="cm-variable">build</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  } <span class="cm-keyword">catch</span> (<span class="cm-variable">KeyManagementException</span> <span class="cm-variable">e</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">e</span>.<span class="cm-variable">printStackTrace</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  } <span class="cm-keyword">catch</span> (<span class="cm-variable">NoSuchAlgorithmException</span> <span class="cm-variable">e</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">e</span>.<span class="cm-variable">printStackTrace</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  } <span class="cm-keyword">catch</span> (<span class="cm-variable">KeyStoreException</span> <span class="cm-variable">e</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">e</span>.<span class="cm-variable">printStackTrace</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">HttpClients</span>.<span class="cm-variable">createDefault</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable-3">void</span> <span class="cm-variable">callInvoiceApply</span>() <span class="cm-keyword">throws</span> <span class="cm-variable">Exception</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp;  提供两种构建HttpClient实例的方法，如果使用被注释掉的方法构建实例报证书不被信任的错误，那么请使用未被注释的构建方法</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp;  HttpClient httpClient = HttpClients.custom().build();</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">HttpClient</span> <span class="cm-variable">httpClient</span> <span class="cm-operator">=</span> <span class="cm-variable">createSSLClientDefault</span>(); &nbsp; &nbsp;<span class="cm-comment">//信任所有https证书</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">HttpPost</span> <span class="cm-variable">httpPost</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HttpPost</span>(<span class="cm-variable">URL</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 构造POST表单Map</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;</span> <span class="cm-variable">paramsMap</span> <span class="cm-operator">=</span> <span class="cm-variable">buildPostParam</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 签名</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">String</span> <span class="cm-variable">sign</span> <span class="cm-operator">=</span> <span class="cm-keyword">this</span>.<span class="cm-variable">sign</span>(<span class="cm-variable">paramsMap</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">httpPost</span>.<span class="cm-variable">addHeader</span>(<span class="cm-string">"sign"</span>, <span class="cm-variable">sign</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 转换POST表单参数</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable">NameValuePair</span><span class="cm-operator">&gt;</span> <span class="cm-variable">list</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">ArrayList</span><span class="cm-operator">&lt;</span><span class="cm-variable">NameValuePair</span><span class="cm-operator">&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Iterator</span><span class="cm-operator">&lt;</span><span class="cm-variable">Entry</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;&gt;</span> <span class="cm-variable">iterator</span> <span class="cm-operator">=</span> <span class="cm-variable">paramsMap</span>.<span class="cm-variable">entrySet</span>().<span class="cm-variable">iterator</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">while</span> (<span class="cm-variable">iterator</span>.<span class="cm-variable">hasNext</span>()) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Entry</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;</span> <span class="cm-variable">elem</span> <span class="cm-operator">=</span> <span class="cm-variable">iterator</span>.<span class="cm-variable">next</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">list</span>.<span class="cm-variable">add</span>(<span class="cm-keyword">new</span> <span class="cm-variable">BasicNameValuePair</span>(<span class="cm-variable">elem</span>.<span class="cm-variable">getKey</span>(), <span class="cm-variable">elem</span>.<span class="cm-variable">getValue</span>()));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">list</span>.<span class="cm-variable">size</span>() <span class="cm-operator">&gt;</span> <span class="cm-number">0</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">UrlEncodedFormEntity</span> <span class="cm-variable">entity</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">UrlEncodedFormEntity</span>(<span class="cm-variable">list</span>, <span class="cm-string">"UTF-8"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">httpPost</span>.<span class="cm-variable">setEntity</span>(<span class="cm-variable">entity</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 发送http post请求，并得到响应结果</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">HttpResponse</span> <span class="cm-variable">response</span> <span class="cm-operator">=</span> <span class="cm-variable">httpClient</span>.<span class="cm-variable">execute</span>(<span class="cm-variable">httpPost</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">String</span> <span class="cm-variable">result</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">response</span> <span class="cm-operator">!=</span> <span class="cm-atom">null</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">HttpEntity</span> <span class="cm-variable">resEntity</span> <span class="cm-operator">=</span> <span class="cm-variable">response</span>.<span class="cm-variable">getEntity</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">resEntity</span> <span class="cm-operator">!=</span> <span class="cm-atom">null</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">result</span> <span class="cm-operator">=</span> <span class="cm-variable">EntityUtils</span>.<span class="cm-variable">toString</span>(<span class="cm-variable">resEntity</span>, <span class="cm-string">"UTF-8"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">System</span>.<span class="cm-variable">out</span>.<span class="cm-variable">println</span>(<span class="cm-variable">result</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 签名</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param paramsMap 表单参数</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return 签名值</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws Exception</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">String</span> <span class="cm-variable">sign</span>(<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;</span> <span class="cm-variable">paramsMap</span>) <span class="cm-keyword">throws</span> <span class="cm-variable">Exception</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">PrivateKey</span> <span class="cm-variable">privateKey</span> <span class="cm-operator">=</span> <span class="cm-variable">loadPrivateKeyOfCA</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">claims</span> <span class="cm-operator">=</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">JwtParamBuilder</span>.<span class="cm-variable">build</span>().<span class="cm-variable">setSubject</span>(<span class="cm-string">"tester"</span>).<span class="cm-variable">setIssuer</span>(<span class="cm-string">"einvoice"</span>).<span class="cm-variable">setAudience</span>(<span class="cm-string">"einvoice"</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  .<span class="cm-variable">addJwtId</span>().<span class="cm-variable">addIssuedAt</span>().<span class="cm-variable">setExpirySeconds</span>(<span class="cm-number">3600</span>).<span class="cm-variable">setNotBeforeSeconds</span>(<span class="cm-number">3600</span>).<span class="cm-variable">getClaims</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 需要将表单参数requestdatas的数据进行md5加密，然后放到签名数据的requestdatas中。</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 此签名数据必须存在，否则在验证签名时会不通过。</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">String</span> <span class="cm-variable">value</span> <span class="cm-operator">=</span> <span class="cm-variable">paramsMap</span>.<span class="cm-variable">get</span>(<span class="cm-string">"requestdatas"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">claims</span>.<span class="cm-variable">put</span>(<span class="cm-string">"requestdatas"</span>, <span class="cm-variable">getMD5</span>(<span class="cm-variable">value</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 使用jdk1.6版本时，删除下面代码的中.compressWith(CompressionCodecs.DEFLATE)</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">String</span> <span class="cm-variable">compactJws</span> <span class="cm-operator">=</span> <span class="cm-variable">Jwts</span>.<span class="cm-variable">builder</span>().<span class="cm-variable">signWith</span>(<span class="cm-variable">SignatureAlgorithm</span>.<span class="cm-variable">RS512</span>, <span class="cm-variable">privateKey</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  .<span class="cm-variable">setClaims</span>(<span class="cm-variable">claims</span>).<span class="cm-variable">compressWith</span>(<span class="cm-variable">CompressionCodecs</span>.<span class="cm-variable">DEFLATE</span>).<span class="cm-variable">compact</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">compactJws</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp;  /**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; * 当在linux环境下运行代码，签名方法报空指针异常的时候，采用该签名方法可以避免这个问题</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; * 使用该方法需要添加新的maven依赖，如下：</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; * &lt;dependency&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; * &nbsp; &nbsp; &lt;groupId&gt;com.auth0&lt;/groupId&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; * &nbsp; &nbsp; &lt;artifactId&gt;java-jwt&lt;/artifactId&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; * &nbsp; &nbsp; &lt;version&gt;3.3.0&lt;/version&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; * &lt;/dependency&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; * @param paramsMap</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; * @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; * @throws Exception</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp;  private String sign(Map&lt;String, String&gt; paramsMap) throws Exception {</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">//</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp;  RSAPrivateKey privateKey = loadPrivateKeyOfCA();</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp;  Map&lt;String, Object&gt; claims =</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JwtParamBuilder.build().setSubject("tester").setIssuer("einvoice").setAudience("einvoice")</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  .addJwtId().addIssuedAt().setExpirySeconds(300).setNotBeforeSeconds(300).getClaims();</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp;  String token;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp;  try {</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Algorithm algorithm = Algorithm.RSA512(null, privateKey);</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  token = JWT.create()</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  .withClaim("requestdatas",getMD5(paramsMap.get("requestdatas")))</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  .withHeader(claims)</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  .sign(algorithm);</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp;  } catch (JWTCreationException exception){</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //Invalid Signing configuration / Couldn't convert Claims.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return null;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp;  }</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">//</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp;  return token;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp;  }</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 计算参数MD5</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param str</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws UnsupportedEncodingException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws NoSuchAlgorithmException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">String</span> <span class="cm-variable">getMD5</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">str</span>) <span class="cm-keyword">throws</span> <span class="cm-variable">UnsupportedEncodingException</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">NoSuchAlgorithmException</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">byte</span>[] <span class="cm-variable">buf</span> <span class="cm-operator">=</span> <span class="cm-atom">null</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">buf</span> <span class="cm-operator">=</span> <span class="cm-variable">str</span>.<span class="cm-variable">getBytes</span>(<span class="cm-string">"utf-8"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">MessageDigest</span> <span class="cm-variable">md5</span> <span class="cm-operator">=</span> <span class="cm-atom">null</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">md5</span> <span class="cm-operator">=</span> <span class="cm-variable">MessageDigest</span>.<span class="cm-variable">getInstance</span>(<span class="cm-string">"MD5"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">md5</span>.<span class="cm-variable">update</span>(<span class="cm-variable">buf</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">byte</span>[] <span class="cm-variable">tmp</span> <span class="cm-operator">=</span> <span class="cm-variable">md5</span>.<span class="cm-variable">digest</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">StringBuilder</span> <span class="cm-variable">sb</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable-3">StringBuilder</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">for</span> (<span class="cm-variable-3">byte</span> <span class="cm-variable">b</span> : <span class="cm-variable">tmp</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">sb</span>.<span class="cm-variable">append</span>(<span class="cm-variable-3">String</span>.<span class="cm-variable">format</span>(<span class="cm-string">"%02x"</span>, <span class="cm-variable">b</span> <span class="cm-operator">&amp;</span> <span class="cm-number">0xff</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">sb</span>.<span class="cm-variable">toString</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 读取证书私钥</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws UnrecoverableKeyException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws KeyStoreException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws NoSuchAlgorithmException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws CertificateException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws IOException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">protected</span> <span class="cm-variable">RSAPrivateKey</span> <span class="cm-variable">loadPrivateKeyOfCA</span>() <span class="cm-keyword">throws</span> <span class="cm-variable">UnrecoverableKeyException</span>, <span class="cm-variable">KeyStoreException</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">NoSuchAlgorithmException</span>, <span class="cm-variable">CertificateException</span>, <span class="cm-variable">IOException</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">FileInputStream</span> <span class="cm-variable">in</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">FileInputStream</span>(<span class="cm-variable">KEYPATH</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">KeyStore</span> <span class="cm-variable">ks</span> <span class="cm-operator">=</span> <span class="cm-variable">KeyStore</span>.<span class="cm-variable">getInstance</span>(<span class="cm-string">"pkcs12"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">ks</span>.<span class="cm-variable">load</span>(<span class="cm-variable">in</span>, <span class="cm-variable">PASSWORD</span>.<span class="cm-variable">toCharArray</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">String</span> <span class="cm-variable">alias</span> <span class="cm-operator">=</span> <span class="cm-variable">ks</span>.<span class="cm-variable">aliases</span>().<span class="cm-variable">nextElement</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">RSAPrivateKey</span> <span class="cm-variable">caprk</span> <span class="cm-operator">=</span> (<span class="cm-variable">RSAPrivateKey</span>) <span class="cm-variable">ks</span>.<span class="cm-variable">getKey</span>(<span class="cm-variable">alias</span>, <span class="cm-variable">PASSWORD</span>.<span class="cm-variable">toCharArray</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">caprk</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* post表单数据</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;</span> <span class="cm-variable">buildPostParam</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;</span> <span class="cm-variable">paramsMap</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">paramsMap</span>.<span class="cm-variable">put</span>(<span class="cm-string">"requestdatas"</span>, <span class="cm-keyword">this</span>.<span class="cm-variable">buildRequestDatas</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">paramsMap</span>.<span class="cm-variable">put</span>(<span class="cm-string">"email"</span>, <span class="cm-keyword">this</span>.<span class="cm-variable">buildEmailConfigs</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">paramsMap</span>.<span class="cm-variable">put</span>(<span class="cm-string">"sms"</span>, <span class="cm-keyword">this</span>.<span class="cm-variable">buildSmsConfigs</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">paramsMap</span>.<span class="cm-variable">put</span>(<span class="cm-string">"url"</span>, <span class="cm-keyword">this</span>.<span class="cm-variable">buildUrlConfigs</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">paramsMap</span>.<span class="cm-variable">put</span>(<span class="cm-string">"autoAudit"</span>, <span class="cm-string">"false"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">paramsMap</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* url回掉配置</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">String</span> <span class="cm-variable">buildUrlConfigs</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">datas</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">ArrayList</span><span class="cm-operator">&lt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">data</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span><span class="cm-operator">&lt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"fpqqlsh"</span>, <span class="cm-variable">buildFpqqlsh</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"url"</span>, <span class="cm-string">"http://117.12.12.3:7787/EinvoiceRESTService/CallBackEInvoices/"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">datas</span>.<span class="cm-variable">add</span>(<span class="cm-variable">data</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">GsonBuilder</span> <span class="cm-variable">builder</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">GsonBuilder</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">builder</span>.<span class="cm-variable">create</span>().<span class="cm-variable">toJson</span>(<span class="cm-variable">datas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 构造短信发送信息</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">String</span> <span class="cm-variable">buildSmsConfigs</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">datas</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">ArrayList</span><span class="cm-operator">&lt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">data</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span><span class="cm-operator">&lt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"fpqqlsh"</span>, <span class="cm-variable">buildFpqqlsh</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"address"</span>, <span class="cm-string">"123123123123"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">datas</span>.<span class="cm-variable">add</span>(<span class="cm-variable">data</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">GsonBuilder</span> <span class="cm-variable">builder</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">GsonBuilder</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">builder</span>.<span class="cm-variable">create</span>().<span class="cm-variable">toJson</span>(<span class="cm-variable">datas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 构造email发送信息</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">String</span> <span class="cm-variable">buildEmailConfigs</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">datas</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">ArrayList</span><span class="cm-operator">&lt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">data</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span><span class="cm-operator">&lt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"fpqqlsh"</span>, <span class="cm-variable">buildFpqqlsh</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"address"</span>, <span class="cm-string">"123@163.com"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">datas</span>.<span class="cm-variable">add</span>(<span class="cm-variable">data</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">GsonBuilder</span> <span class="cm-variable">builder</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">GsonBuilder</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">builder</span>.<span class="cm-variable">create</span>().<span class="cm-variable">toJson</span>(<span class="cm-variable">datas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 构造requestdatas</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">String</span> <span class="cm-variable">buildRequestDatas</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">datas</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">ArrayList</span><span class="cm-operator">&lt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">data</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span><span class="cm-operator">&lt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"FPQQLSH"</span>, <span class="cm-variable">buildFpqqlsh</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//测试环境请一定要使用测试纳税人识别号</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"XSF_NSRSBH"</span>, <span class="cm-string">"201609140000001"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"GMF_MC"</span>, <span class="cm-string">"购买方名称"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"GMF_DZDH"</span>, <span class="cm-string">"购买方地址电话"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//组织编码，测试环境请一定使用测试环境的组织编码</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"ORGCODE"</span>, <span class="cm-string">"20160914001"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"JSHJ"</span>, <span class="cm-number">1395.00</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"items"</span>, <span class="cm-variable">buildItems</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">datas</span>.<span class="cm-variable">add</span>(<span class="cm-variable">data</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">GsonBuilder</span> <span class="cm-variable">builder</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">GsonBuilder</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">builder</span>.<span class="cm-variable">create</span>().<span class="cm-variable">toJson</span>(<span class="cm-variable">datas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 构造request发票明细</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">buildItems</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">items</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">ArrayList</span><span class="cm-operator">&lt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">data</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span><span class="cm-operator">&lt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"XMJSHJ"</span>, <span class="cm-string">"1395.00"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"XMMC"</span>, <span class="cm-string">"住宅物业管理费1"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//税率16%需要写成0.16的格式</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"SL"</span>, <span class="cm-number">0.16</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//SPBM字段为商品税收分类编码，不同的商品会有不同的编码，不对应的话会影响报税，需要咨询下公司财务</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"SPBM"</span>, <span class="cm-string">"3040502029902000000"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">items</span>.<span class="cm-variable">add</span>(<span class="cm-variable">data</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">items</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 获取发票请求流水号</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 长度不超过20位，长度在1到20位的字母和数字组合，不可以重复的，不要包含window系统文件名限制的特殊字符</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return 发票请求流水号</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">String</span> <span class="cm-variable">buildFpqqlsh</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-string">"164291i05h2080000sKs"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 7943px;"></div><div class="CodeMirror-gutters" style="display: none; height: 7973px;"></div></div></div></pre><h5><a name='header-n2574' class='md-header-anchor '></a><strong>API相关工具类</strong></h5><pre class="md-fences md-end-block" lang="java" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">package</span> <span class="cm-def">com</span>.<span class="cm-variable">yonyou</span>.<span class="cm-variable">einvoice</span>.<span class="cm-variable">test</span>;</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">util</span>.<span class="cm-variable">HashMap</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">util</span>.<span class="cm-variable">Map</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">util</span>.<span class="cm-variable">UUID</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* @author wangweir</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">public</span> <span class="cm-keyword">class</span> <span class="cm-def">JwtParamBuilder</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code Issuer} claims parameter name: &lt;code&gt;"iss"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">ISSUER</span> <span class="cm-operator">=</span> <span class="cm-string">"iss"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code Subject} claims parameter name: &lt;code&gt;"sub"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">SUBJECT</span> <span class="cm-operator">=</span> <span class="cm-string">"sub"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code Audience} claims parameter name: &lt;code&gt;"aud"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">AUDIENCE</span> <span class="cm-operator">=</span> <span class="cm-string">"aud"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code Expiration} claims parameter name: &lt;code&gt;"exp"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">EXPIRATION</span> <span class="cm-operator">=</span> <span class="cm-string">"exp"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code Not Before} claims parameter name: &lt;code&gt;"nbf"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">NOT_BEFORE</span> <span class="cm-operator">=</span> <span class="cm-string">"nbf"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code Issued At} claims parameter name: &lt;code&gt;"iat"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">ISSUED_AT</span> <span class="cm-operator">=</span> <span class="cm-string">"iat"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code JWT ID} claims parameter name: &lt;code&gt;"jti"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">ID</span> <span class="cm-operator">=</span> <span class="cm-string">"jti"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">claims</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">long</span> <span class="cm-variable">now</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable">JwtParamBuilder</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">claims</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span><span class="cm-operator">&lt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">now</span> <span class="cm-operator">=</span> <span class="cm-variable">System</span>.<span class="cm-variable">currentTimeMillis</span>() <span class="cm-operator">/</span> <span class="cm-number">1000l</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">build</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">new</span> <span class="cm-variable">JwtParamBuilder</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">addIssuedAt</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">claims</span>.<span class="cm-variable">put</span>(<span class="cm-variable">ISSUED_AT</span>, <span class="cm-variable">now</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">setExpirySeconds</span>(<span class="cm-keyword">final</span> <span class="cm-variable-3">Integer</span> <span class="cm-variable">expirySeconds</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">claims</span>.<span class="cm-variable">put</span>(<span class="cm-variable">EXPIRATION</span>, <span class="cm-variable">now</span> <span class="cm-operator">+</span> <span class="cm-variable">expirySeconds</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">setNotBeforeSeconds</span>(<span class="cm-keyword">final</span> <span class="cm-variable-3">Integer</span> <span class="cm-variable">beforeSeconds</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">claims</span>.<span class="cm-variable">put</span>(<span class="cm-variable">NOT_BEFORE</span>, <span class="cm-variable">now</span> <span class="cm-operator">-</span> <span class="cm-variable">beforeSeconds</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">setSubject</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">sub</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">addOneClaim</span>(<span class="cm-variable">SUBJECT</span>, <span class="cm-variable">sub</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">setIssuer</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">iss</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">addOneClaim</span>(<span class="cm-variable">ISSUER</span>, <span class="cm-variable">iss</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">setAudience</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">aud</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">addOneClaim</span>(<span class="cm-variable">AUDIENCE</span>, <span class="cm-variable">aud</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">addJwtId</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">setJwtId</span>(<span class="cm-variable">UUID</span>.<span class="cm-variable">randomUUID</span>().<span class="cm-variable">toString</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">setJwtId</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">jwtid</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">addOneClaim</span>(<span class="cm-variable">ID</span>, <span class="cm-variable">UUID</span>.<span class="cm-variable">randomUUID</span>().<span class="cm-variable">toString</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">claim</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">name</span>, <span class="cm-variable-3">Object</span> <span class="cm-variable">value</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">value</span> <span class="cm-operator">==</span> <span class="cm-atom">null</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;<span class="cm-keyword">this</span>.<span class="cm-variable">claims</span>.<span class="cm-variable">remove</span>(<span class="cm-variable">name</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  } <span class="cm-keyword">else</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;<span class="cm-keyword">this</span>.<span class="cm-variable">claims</span>.<span class="cm-variable">put</span>(<span class="cm-variable">name</span>, <span class="cm-variable">value</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">void</span> <span class="cm-variable">addOneClaim</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">key</span>, <span class="cm-variable-3">String</span> <span class="cm-variable">value</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">value</span> <span class="cm-operator">!=</span> <span class="cm-atom">null</span> <span class="cm-operator">&amp;&amp;</span> <span class="cm-variable">value</span>.<span class="cm-variable">length</span>() <span class="cm-operator">&gt;</span> <span class="cm-number">0</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;<span class="cm-variable">claims</span>.<span class="cm-variable">put</span>(<span class="cm-variable">key</span>, <span class="cm-variable">value</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; <span class="cm-comment">* @return the claims</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">getClaims</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">claims</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 2584px;"></div><div class="CodeMirror-gutters" style="display: none; height: 2614px;"></div></div></div></pre><h4><a name='header-n2576' class='md-header-anchor '></a><strong>Java（适用于JDK1.5）</strong></h4><h5><a name='header-n2577' class='md-header-anchor '></a><strong>Maven配置文件依赖</strong></h5><p>依赖配置如下，除此之外还需要单独引入JWT的java-jwt-2.2.1-SNAPSHOT.jar包，请联系接口调试人员获取jar包。</p><pre class="md-fences md-end-block" lang="xml" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span>org.apache.httpcomponents<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span>httpclient<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span>4.3<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span>com.google.code.gson<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span>gson<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span>2.1<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span>org.bouncycastle<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span>bcprov-jdk15on<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span>1.52<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span>commons-codec<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span>commons-codec<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span>1.1<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span>com.fasterxml.jackson.core<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span>jackson-annotations<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span>2.0.1<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span>commons-io<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span>commons-io<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span>1.2<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span>com.fasterxml.jackson.core<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span>jackson-core<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span>2.0.1<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span>com.fasterxml.jackson.core<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">groupId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span>jackson-databind<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">artifactId</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span>2.0.1<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">version</span><span class="cm-tag cm-bracket">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-tag cm-bracket">&lt;/</span><span class="cm-tag">dependency</span><span class="cm-tag cm-bracket">&gt;</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 928px;"></div><div class="CodeMirror-gutters" style="display: none; height: 958px;"></div></div></div></pre><h5><a name='header-n2581' class='md-header-anchor '></a><strong>API调用代码</strong></h5><pre class="md-fences md-end-block" lang="java" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">com</span>.<span class="cm-variable">auth0</span>.<span class="cm-variable">jwt</span>.<span class="cm-variable">Algorithm</span>;</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">com</span>.<span class="cm-variable">auth0</span>.<span class="cm-variable">jwt</span>.<span class="cm-variable">JWTSigner</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">com</span>.<span class="cm-variable">google</span>.<span class="cm-variable">gson</span>.<span class="cm-variable">GsonBuilder</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">HttpEntity</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">HttpResponse</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">NameValuePair</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">client</span>.<span class="cm-variable">HttpClient</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">client</span>.<span class="cm-variable">entity</span>.<span class="cm-variable">UrlEncodedFormEntity</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">client</span>.<span class="cm-variable">methods</span>.<span class="cm-variable">HttpPost</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">conn</span>.<span class="cm-variable">ssl</span>.<span class="cm-variable">SSLConnectionSocketFactory</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">conn</span>.<span class="cm-variable">ssl</span>.<span class="cm-variable">X509HostnameVerifier</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">impl</span>.<span class="cm-variable">client</span>.<span class="cm-variable">CloseableHttpClient</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">impl</span>.<span class="cm-variable">client</span>.<span class="cm-variable">HttpClients</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">message</span>.<span class="cm-variable">BasicNameValuePair</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">org</span>.<span class="cm-variable">apache</span>.<span class="cm-variable">http</span>.<span class="cm-variable">util</span>.<span class="cm-variable">EntityUtils</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">javax</span>.<span class="cm-variable">net</span>.<span class="cm-variable">ssl</span>.<span class="cm-operator">*</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">io</span>.<span class="cm-variable">FileInputStream</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">io</span>.<span class="cm-variable">IOException</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">io</span>.<span class="cm-variable">UnsupportedEncodingException</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">security</span>.<span class="cm-operator">*</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">security</span>.<span class="cm-variable">cert</span>.<span class="cm-variable">CertificateException</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">security</span>.<span class="cm-variable">cert</span>.<span class="cm-variable">X509Certificate</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">security</span>.<span class="cm-variable">interfaces</span>.<span class="cm-variable">RSAPrivateKey</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">util</span>.<span class="cm-operator">*</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* @author xingguoqing</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* 开具蓝票接口，本样例适合JDK1.5，除了需要按照pom文件引入相关jar外，还需要单独引入jwt包（联系接口调试人员）</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* @date 2018/5/9 下午1:37</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">public</span> <span class="cm-keyword">class</span> <span class="cm-def">InsertWithArray</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">//测试环境有测试appid和证书，正式环境有正式appid和证书，请务必对应使用</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">//测试环境appid就用这个，正式环境需要替换成正式的</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">String</span> <span class="cm-variable">APPID</span> <span class="cm-operator">=</span> <span class="cm-string">"commontesterCA"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">//这个是测试环境的域名，正式环境为https://fapiao.yonyoucloud.com</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">String</span> <span class="cm-variable">DOMAIN</span> <span class="cm-operator">=</span> <span class="cm-string">"https://yesfp.yonyoucloud.com"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">String</span> <span class="cm-variable">URL</span> <span class="cm-operator">=</span> <span class="cm-variable">DOMAIN</span> <span class="cm-operator">+</span> <span class="cm-string">"/invoiceclient-web/api/invoiceApply/insertWithArray?appid="</span> <span class="cm-operator">+</span> <span class="cm-variable">APPID</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">//pro22.pfx为测试环境通讯证书，正式环境需要替换成正式的</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">String</span> <span class="cm-variable">KEYPATH</span> <span class="cm-operator">=</span> <span class="cm-string">"src/main/resources/certificate/pro22.pfx"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">//证书密码</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">String</span> <span class="cm-variable">PASSWORD</span> <span class="cm-operator">=</span> <span class="cm-string">"password"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-keyword">class</span> <span class="cm-def">TrustAnyTrustManager</span> <span class="cm-keyword">implements</span> <span class="cm-variable">X509TrustManager</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable-3">void</span> <span class="cm-variable">checkClientTrusted</span>(<span class="cm-variable">X509Certificate</span>[] <span class="cm-variable">chain</span>, <span class="cm-variable-3">String</span> <span class="cm-variable">authType</span>) <span class="cm-keyword">throws</span> <span class="cm-variable">CertificateException</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable-3">void</span> <span class="cm-variable">checkServerTrusted</span>(<span class="cm-variable">X509Certificate</span>[] <span class="cm-variable">chain</span>, <span class="cm-variable-3">String</span> <span class="cm-variable">authType</span>) <span class="cm-keyword">throws</span> <span class="cm-variable">CertificateException</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">X509Certificate</span>[] <span class="cm-variable">getAcceptedIssuers</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">new</span> <span class="cm-variable">X509Certificate</span>[]{};</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-keyword">class</span> <span class="cm-def">TrustAnyHostnameVerifier</span> <span class="cm-keyword">implements</span> <span class="cm-variable">X509HostnameVerifier</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable-3">boolean</span> <span class="cm-variable">verify</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">hostname</span>, <span class="cm-variable">SSLSession</span> <span class="cm-variable">session</span>){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-atom">true</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable-3">void</span> <span class="cm-variable">verify</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">s</span>, <span class="cm-variable">SSLSocket</span> <span class="cm-variable">sslSocket</span>) <span class="cm-keyword">throws</span> <span class="cm-variable">IOException</span> { }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable-3">void</span> <span class="cm-variable">verify</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">s</span>, <span class="cm-variable">X509Certificate</span> <span class="cm-variable">x509Certificate</span>) <span class="cm-keyword">throws</span> <span class="cm-variable">SSLException</span> {}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable-3">void</span> <span class="cm-variable">verify</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">s</span>, <span class="cm-variable-3">String</span>[] <span class="cm-variable">strings</span>, <span class="cm-variable-3">String</span>[] <span class="cm-variable">strings1</span>) <span class="cm-keyword">throws</span> <span class="cm-variable">SSLException</span> {}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable">CloseableHttpClient</span> <span class="cm-variable">createSSLClientDefault</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">try</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">SSLContext</span> <span class="cm-variable">sslContext</span> <span class="cm-operator">=</span> <span class="cm-variable">SSLContext</span>.<span class="cm-variable">getInstance</span>(<span class="cm-string">"SSL"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">sslContext</span>.<span class="cm-variable">init</span>(<span class="cm-atom">null</span>, <span class="cm-keyword">new</span> <span class="cm-variable">TrustManager</span>[]{<span class="cm-keyword">new</span> <span class="cm-variable">InsertWithArray</span>.<span class="cm-variable">TrustAnyTrustManager</span>()}, <span class="cm-keyword">new</span> <span class="cm-variable">java</span>.<span class="cm-variable">security</span>.<span class="cm-variable">SecureRandom</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">SSLConnectionSocketFactory</span> <span class="cm-variable">sslsf</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">SSLConnectionSocketFactory</span>(<span class="cm-variable">sslContext</span>,<span class="cm-keyword">new</span> <span class="cm-variable">InsertWithArray</span>.<span class="cm-variable">TrustAnyHostnameVerifier</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">HttpClients</span>.<span class="cm-variable">custom</span>().<span class="cm-variable">setSSLSocketFactory</span>(<span class="cm-variable">sslsf</span>).<span class="cm-variable">build</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  } <span class="cm-keyword">catch</span> (<span class="cm-variable">Exception</span> <span class="cm-variable">e</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">e</span>.<span class="cm-variable">printStackTrace</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">HttpClients</span>.<span class="cm-variable">createDefault</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">void</span> <span class="cm-variable">main</span>(<span class="cm-variable-3">String</span>[] <span class="cm-variable">args</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">try</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">new</span> <span class="cm-variable">InsertWithArray</span>().<span class="cm-variable">callInvoiceApply</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  } <span class="cm-keyword">catch</span> (<span class="cm-variable">Exception</span> <span class="cm-variable">e</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">e</span>.<span class="cm-variable">printStackTrace</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 调用接口开票</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws Exception</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable-3">void</span> <span class="cm-variable">callInvoiceApply</span>() <span class="cm-keyword">throws</span> <span class="cm-variable">Exception</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">HttpClient</span> <span class="cm-variable">httpClient</span> <span class="cm-operator">=</span> <span class="cm-variable">createSSLClientDefault</span>(); &nbsp; &nbsp;<span class="cm-comment">//忽略https证书</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">HttpPost</span> <span class="cm-variable">httpPost</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HttpPost</span>(<span class="cm-variable">URL</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 构造POST表单Map</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;</span> <span class="cm-variable">paramsMap</span> <span class="cm-operator">=</span> <span class="cm-variable">buildPostParam</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">System</span>.<span class="cm-variable">out</span>.<span class="cm-variable">println</span>(<span class="cm-variable">paramsMap</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 签名</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">String</span> <span class="cm-variable">sign</span> <span class="cm-operator">=</span> <span class="cm-keyword">this</span>.<span class="cm-variable">sign</span>(<span class="cm-variable">paramsMap</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">System</span>.<span class="cm-variable">out</span>.<span class="cm-variable">println</span>(<span class="cm-variable">sign</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">httpPost</span>.<span class="cm-variable">addHeader</span>(<span class="cm-string">"sign"</span>, <span class="cm-variable">sign</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 转换POST表单参数</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable">NameValuePair</span><span class="cm-operator">&gt;</span> <span class="cm-variable">list</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">ArrayList</span><span class="cm-operator">&lt;</span><span class="cm-variable">NameValuePair</span><span class="cm-operator">&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Iterator</span><span class="cm-operator">&lt;</span><span class="cm-variable">Map</span>.<span class="cm-variable">Entry</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;&gt;</span> <span class="cm-variable">iterator</span> <span class="cm-operator">=</span> <span class="cm-variable">paramsMap</span>.<span class="cm-variable">entrySet</span>().<span class="cm-variable">iterator</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">while</span> (<span class="cm-variable">iterator</span>.<span class="cm-variable">hasNext</span>()) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span>.<span class="cm-variable">Entry</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;</span> <span class="cm-variable">elem</span> <span class="cm-operator">=</span> <span class="cm-variable">iterator</span>.<span class="cm-variable">next</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">list</span>.<span class="cm-variable">add</span>(<span class="cm-keyword">new</span> <span class="cm-variable">BasicNameValuePair</span>(<span class="cm-variable">elem</span>.<span class="cm-variable">getKey</span>(), <span class="cm-variable">elem</span>.<span class="cm-variable">getValue</span>()));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">list</span>.<span class="cm-variable">size</span>() <span class="cm-operator">&gt;</span> <span class="cm-number">0</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">UrlEncodedFormEntity</span> <span class="cm-variable">entity</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">UrlEncodedFormEntity</span>(<span class="cm-variable">list</span>, <span class="cm-string">"UTF-8"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">httpPost</span>.<span class="cm-variable">setEntity</span>(<span class="cm-variable">entity</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 发送http post请求，并得到响应结果</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">HttpResponse</span> <span class="cm-variable">response</span> <span class="cm-operator">=</span> <span class="cm-variable">httpClient</span>.<span class="cm-variable">execute</span>(<span class="cm-variable">httpPost</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">String</span> <span class="cm-variable">result</span> <span class="cm-operator">=</span> <span class="cm-string">""</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">response</span> <span class="cm-operator">!=</span> <span class="cm-atom">null</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">HttpEntity</span> <span class="cm-variable">resEntity</span> <span class="cm-operator">=</span> <span class="cm-variable">response</span>.<span class="cm-variable">getEntity</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">resEntity</span> <span class="cm-operator">!=</span> <span class="cm-atom">null</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">result</span> <span class="cm-operator">=</span> <span class="cm-variable">EntityUtils</span>.<span class="cm-variable">toString</span>(<span class="cm-variable">resEntity</span>, <span class="cm-string">"UTF-8"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">System</span>.<span class="cm-variable">out</span>.<span class="cm-variable">println</span>(<span class="cm-variable">result</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 签名</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param paramsMap 表单参数</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return 签名值</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws Exception</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">String</span> <span class="cm-variable">sign</span>(<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;</span> <span class="cm-variable">paramsMap</span>) <span class="cm-keyword">throws</span> <span class="cm-variable">Exception</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 读取CA证书</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">PrivateKey</span> <span class="cm-variable">privateKey</span> <span class="cm-operator">=</span> <span class="cm-variable">loadPrivateKeyOfCA</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">claims</span> <span class="cm-operator">=</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">JwtParamBuilder</span>.<span class="cm-variable">build</span>().<span class="cm-variable">setSubject</span>(<span class="cm-string">"tester"</span>).<span class="cm-variable">setIssuer</span>(<span class="cm-string">"einvoice"</span>).<span class="cm-variable">setAudience</span>(<span class="cm-string">"einvoice"</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  .<span class="cm-variable">addJwtId</span>().<span class="cm-variable">addIssuedAt</span>().<span class="cm-variable">setExpirySeconds</span>(<span class="cm-number">3600</span>).<span class="cm-variable">setNotBeforeSeconds</span>(<span class="cm-number">3600</span>).<span class="cm-variable">getClaims</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 需要将表单参数requestdatas的数据进行md5加密，然后放到签名数据的requestdatas中。</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// 此签名数据必须存在，否则在验证签名时会不通过。</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">String</span> <span class="cm-variable">value</span> <span class="cm-operator">=</span> <span class="cm-variable">paramsMap</span>.<span class="cm-variable">get</span>(<span class="cm-string">"requestdatas"</span>).<span class="cm-variable">toString</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">claims</span>.<span class="cm-variable">put</span>(<span class="cm-string">"requestdatas"</span>, <span class="cm-variable">getMD5</span>(<span class="cm-variable">value</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">JWTSigner</span> <span class="cm-variable">signer</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">JWTSigner</span>(<span class="cm-variable">privateKey</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">String</span> <span class="cm-variable">compactJws</span> <span class="cm-operator">=</span> <span class="cm-variable">signer</span>.<span class="cm-variable">sign</span>(<span class="cm-variable">claims</span>, <span class="cm-keyword">new</span> <span class="cm-variable">JWTSigner</span>.<span class="cm-variable">Options</span>().<span class="cm-variable">setExpirySeconds</span>(<span class="cm-number">300</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  .<span class="cm-variable">setNotValidBeforeLeeway</span>(<span class="cm-number">5</span>).<span class="cm-variable">setIssuedAt</span>(<span class="cm-atom">true</span>).<span class="cm-variable">setJwtId</span>(<span class="cm-atom">true</span>).<span class="cm-variable">setAlgorithm</span>(<span class="cm-variable">Algorithm</span>.<span class="cm-variable">RS256</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">compactJws</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 计算MD5</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param str</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws UnsupportedEncodingException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws NoSuchAlgorithmException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">String</span> <span class="cm-variable">getMD5</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">str</span>) <span class="cm-keyword">throws</span> <span class="cm-variable">UnsupportedEncodingException</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">NoSuchAlgorithmException</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">byte</span>[] <span class="cm-variable">buf</span> <span class="cm-operator">=</span> <span class="cm-atom">null</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">buf</span> <span class="cm-operator">=</span> <span class="cm-variable">str</span>.<span class="cm-variable">getBytes</span>(<span class="cm-string">"utf-8"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">MessageDigest</span> <span class="cm-variable">md5</span> <span class="cm-operator">=</span> <span class="cm-atom">null</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">md5</span> <span class="cm-operator">=</span> <span class="cm-variable">MessageDigest</span>.<span class="cm-variable">getInstance</span>(<span class="cm-string">"MD5"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">md5</span>.<span class="cm-variable">update</span>(<span class="cm-variable">buf</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">byte</span>[] <span class="cm-variable">tmp</span> <span class="cm-operator">=</span> <span class="cm-variable">md5</span>.<span class="cm-variable">digest</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">StringBuilder</span> <span class="cm-variable">sb</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable-3">StringBuilder</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">for</span> (<span class="cm-variable-3">byte</span> <span class="cm-variable">b</span> : <span class="cm-variable">tmp</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">sb</span>.<span class="cm-variable">append</span>(<span class="cm-variable-3">String</span>.<span class="cm-variable">format</span>(<span class="cm-string">"%02x"</span>, <span class="cm-variable">b</span> <span class="cm-operator">&amp;</span> <span class="cm-number">0xff</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">sb</span>.<span class="cm-variable">toString</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 读取证书私钥</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws UnrecoverableKeyException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws KeyStoreException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws NoSuchAlgorithmException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws CertificateException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws IOException</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">protected</span> <span class="cm-variable">RSAPrivateKey</span> <span class="cm-variable">loadPrivateKeyOfCA</span>() <span class="cm-keyword">throws</span> <span class="cm-variable">UnrecoverableKeyException</span>, <span class="cm-variable">KeyStoreException</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">NoSuchAlgorithmException</span>, <span class="cm-variable">CertificateException</span>, <span class="cm-variable">IOException</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">FileInputStream</span> <span class="cm-variable">in</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">FileInputStream</span>(<span class="cm-variable">KEYPATH</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">KeyStore</span> <span class="cm-variable">ks</span> <span class="cm-operator">=</span> <span class="cm-variable">KeyStore</span>.<span class="cm-variable">getInstance</span>(<span class="cm-string">"pkcs12"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">ks</span>.<span class="cm-variable">load</span>(<span class="cm-variable">in</span>, <span class="cm-variable">PASSWORD</span>.<span class="cm-variable">toCharArray</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-3">String</span> <span class="cm-variable">alias</span> <span class="cm-operator">=</span> <span class="cm-variable">ks</span>.<span class="cm-variable">aliases</span>().<span class="cm-variable">nextElement</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">RSAPrivateKey</span> <span class="cm-variable">caprk</span> <span class="cm-operator">=</span> (<span class="cm-variable">RSAPrivateKey</span>) <span class="cm-variable">ks</span>.<span class="cm-variable">getKey</span>(<span class="cm-variable">alias</span>, <span class="cm-variable">PASSWORD</span>.<span class="cm-variable">toCharArray</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">caprk</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* post表单数据</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;</span> <span class="cm-variable">buildPostParam</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;</span> <span class="cm-variable">paramsMap</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">String</span><span class="cm-operator">&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">paramsMap</span>.<span class="cm-variable">put</span>(<span class="cm-string">"requestdatas"</span>, <span class="cm-keyword">this</span>.<span class="cm-variable">buildRequestDatas</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp;  paramsMap.put("email", this.buildEmailConfigs());</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp;  paramsMap.put("sms", this.buildSmsConfigs());</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp;  paramsMap.put("url", this.buildUrlConfigs());</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">// &nbsp; &nbsp; &nbsp;  paramsMap.put("autoAudit", "false");</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">paramsMap</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* url回掉配置</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">String</span> <span class="cm-variable">buildUrlConfigs</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">datas</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">ArrayList</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">data</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"fpqqlsh"</span>, <span class="cm-variable">buildFpqqlsh</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"url"</span>, <span class="cm-string">"http://117.12.12.3:7787/EinvoiceRESTService/CallBackEInvoices/"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">datas</span>.<span class="cm-variable">add</span>(<span class="cm-variable">data</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">GsonBuilder</span> <span class="cm-variable">builder</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">GsonBuilder</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">builder</span>.<span class="cm-variable">create</span>().<span class="cm-variable">toJson</span>(<span class="cm-variable">datas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 构造短信发送信息</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">String</span> <span class="cm-variable">buildSmsConfigs</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">datas</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">ArrayList</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">data</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"fpqqlsh"</span>, <span class="cm-variable">buildFpqqlsh</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"address"</span>, <span class="cm-string">"15611500957"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">datas</span>.<span class="cm-variable">add</span>(<span class="cm-variable">data</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">GsonBuilder</span> <span class="cm-variable">builder</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">GsonBuilder</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">builder</span>.<span class="cm-variable">create</span>().<span class="cm-variable">toJson</span>(<span class="cm-variable">datas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 构造email发送信息</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">String</span> <span class="cm-variable">buildEmailConfigs</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">datas</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">ArrayList</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">data</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"fpqqlsh"</span>, <span class="cm-variable">buildFpqqlsh</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"address"</span>, <span class="cm-string">"xinggq7@yonyou.com"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">datas</span>.<span class="cm-variable">add</span>(<span class="cm-variable">data</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">GsonBuilder</span> <span class="cm-variable">builder</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">GsonBuilder</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">builder</span>.<span class="cm-variable">create</span>().<span class="cm-variable">toJson</span>(<span class="cm-variable">datas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 构造requestdatas</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">String</span> <span class="cm-variable">buildRequestDatas</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">datas</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">ArrayList</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">data</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"FPQQLSH"</span>, <span class="cm-variable">buildFpqqlsh</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//测试环境请一定要使用测试纳税人识别号</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"XSF_NSRSBH"</span>, <span class="cm-string">"201609140000001"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//组织编码，测试环境请一定使用测试环境的组织编码</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"ORGCODE"</span>, <span class="cm-string">"20160914001"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"GMF_MC"</span>, <span class="cm-string">"123"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"JSHJ"</span>, <span class="cm-number">0</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"items"</span>, <span class="cm-variable">buildItems</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">datas</span>.<span class="cm-variable">add</span>(<span class="cm-variable">data</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">GsonBuilder</span> <span class="cm-variable">builder</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">GsonBuilder</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">builder</span>.<span class="cm-variable">create</span>().<span class="cm-variable">toJson</span>(<span class="cm-variable">datas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 构造request发票明细</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">buildItems</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">items</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">ArrayList</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">data</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"XMJSHJ"</span>, <span class="cm-number">10951200</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"XMMC"</span>, <span class="cm-string">"住宅物业管理费"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//税率17%需要写成0.17的格式</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"SL"</span>, <span class="cm-number">0.17</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"XMSL"</span>, <span class="cm-number">146016</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//SPBM字段为商品税收分类编码，不同的商品会有不同的编码，不对应的话会影响报税，需要咨询下公司财务</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">data</span>.<span class="cm-variable">put</span>(<span class="cm-string">"SPBM"</span>, <span class="cm-string">"3040502029902000000"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">items</span>.<span class="cm-variable">add</span>(<span class="cm-variable">data</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">items</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* 获取发票请求流水号</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*长度不超过20位，长度在1到20位的字母和数字组合，不可以重复的，不要包含window系统文件名限制的特殊字符</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return 发票请求流水号</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">String</span> <span class="cm-variable">buildFpqqlsh</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-string">"1k4f91i05h2080000sKs"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 7368px;"></div><div class="CodeMirror-gutters" style="display: none; height: 7398px;"></div></div></div></pre><h5><a name='header-n2583' class='md-header-anchor '></a><strong>API相关工具类</strong></h5><pre class="md-fences md-end-block" lang="java" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">package</span> <span class="cm-def">com</span>.<span class="cm-variable">yonyou</span>.<span class="cm-variable">einvoice</span>.<span class="cm-variable">test</span>;</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">util</span>.<span class="cm-variable">HashMap</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">util</span>.<span class="cm-variable">Map</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">import</span> <span class="cm-variable">java</span>.<span class="cm-variable">util</span>.<span class="cm-variable">UUID</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* @author wangweir</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">public</span> <span class="cm-keyword">class</span> <span class="cm-def">JwtParamBuilder</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code Issuer} claims parameter name: &lt;code&gt;"iss"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">ISSUER</span> <span class="cm-operator">=</span> <span class="cm-string">"iss"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code Subject} claims parameter name: &lt;code&gt;"sub"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">SUBJECT</span> <span class="cm-operator">=</span> <span class="cm-string">"sub"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code Audience} claims parameter name: &lt;code&gt;"aud"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">AUDIENCE</span> <span class="cm-operator">=</span> <span class="cm-string">"aud"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code Expiration} claims parameter name: &lt;code&gt;"exp"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">EXPIRATION</span> <span class="cm-operator">=</span> <span class="cm-string">"exp"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code Not Before} claims parameter name: &lt;code&gt;"nbf"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">NOT_BEFORE</span> <span class="cm-operator">=</span> <span class="cm-string">"nbf"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code Issued At} claims parameter name: &lt;code&gt;"iat"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">ISSUED_AT</span> <span class="cm-operator">=</span> <span class="cm-string">"iat"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/** JWT {@code JWT ID} claims parameter name: &lt;code&gt;"jti"&lt;/code&gt; */</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">String</span> <span class="cm-variable">ID</span> <span class="cm-operator">=</span> <span class="cm-string">"jti"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">claims</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">final</span> <span class="cm-variable-3">long</span> <span class="cm-variable">now</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable">JwtParamBuilder</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">claims</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">HashMap</span><span class="cm-operator">&lt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">now</span> <span class="cm-operator">=</span> <span class="cm-variable">System</span>.<span class="cm-variable">currentTimeMillis</span>() <span class="cm-operator">/</span> <span class="cm-number">1000l</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">build</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">new</span> <span class="cm-variable">JwtParamBuilder</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">addIssuedAt</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">claims</span>.<span class="cm-variable">put</span>(<span class="cm-variable">ISSUED_AT</span>, <span class="cm-variable">now</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">setExpirySeconds</span>(<span class="cm-keyword">final</span> <span class="cm-variable-3">Integer</span> <span class="cm-variable">expirySeconds</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">claims</span>.<span class="cm-variable">put</span>(<span class="cm-variable">EXPIRATION</span>, <span class="cm-variable">now</span> <span class="cm-operator">+</span> <span class="cm-variable">expirySeconds</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">setNotBeforeSeconds</span>(<span class="cm-keyword">final</span> <span class="cm-variable-3">Integer</span> <span class="cm-variable">beforeSeconds</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">claims</span>.<span class="cm-variable">put</span>(<span class="cm-variable">NOT_BEFORE</span>, <span class="cm-variable">now</span> <span class="cm-operator">-</span> <span class="cm-variable">beforeSeconds</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">setSubject</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">sub</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">addOneClaim</span>(<span class="cm-variable">SUBJECT</span>, <span class="cm-variable">sub</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">setIssuer</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">iss</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">addOneClaim</span>(<span class="cm-variable">ISSUER</span>, <span class="cm-variable">iss</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">setAudience</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">aud</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">addOneClaim</span>(<span class="cm-variable">AUDIENCE</span>, <span class="cm-variable">aud</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">addJwtId</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">setJwtId</span>(<span class="cm-variable">UUID</span>.<span class="cm-variable">randomUUID</span>().<span class="cm-variable">toString</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">setJwtId</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">jwtid</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-variable">addOneClaim</span>(<span class="cm-variable">ID</span>, <span class="cm-variable">UUID</span>.<span class="cm-variable">randomUUID</span>().<span class="cm-variable">toString</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">JwtParamBuilder</span> <span class="cm-variable">claim</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">name</span>, <span class="cm-variable-3">Object</span> <span class="cm-variable">value</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">value</span> <span class="cm-operator">==</span> <span class="cm-atom">null</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;<span class="cm-keyword">this</span>.<span class="cm-variable">claims</span>.<span class="cm-variable">remove</span>(<span class="cm-variable">name</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  } <span class="cm-keyword">else</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;<span class="cm-keyword">this</span>.<span class="cm-variable">claims</span>.<span class="cm-variable">put</span>(<span class="cm-variable">name</span>, <span class="cm-variable">value</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-keyword">this</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">private</span> <span class="cm-variable-3">void</span> <span class="cm-variable">addOneClaim</span>(<span class="cm-variable-3">String</span> <span class="cm-variable">key</span>, <span class="cm-variable-3">String</span> <span class="cm-variable">value</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">value</span> <span class="cm-operator">!=</span> <span class="cm-atom">null</span> <span class="cm-operator">&amp;&amp;</span> <span class="cm-variable">value</span>.<span class="cm-variable">length</span>() <span class="cm-operator">&gt;</span> <span class="cm-number">0</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;<span class="cm-variable">claims</span>.<span class="cm-variable">put</span>(<span class="cm-variable">key</span>, <span class="cm-variable">value</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; <span class="cm-comment">* @return the claims</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">public</span> <span class="cm-variable">Map</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">String</span>, <span class="cm-variable-3">Object</span><span class="cm-operator">&gt;</span> <span class="cm-variable">getClaims</span>() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">claims</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 2584px;"></div><div class="CodeMirror-gutters" style="display: none; height: 2614px;"></div></div></div></pre><h4><a name='header-n2585' class='md-header-anchor '></a><strong>C#</strong></h4><h5><a name='header-n2586' class='md-header-anchor '></a>添加引用</h5><blockquote><p>使用包管理开发工具NuGet添加依赖。NuGet具体使用方法请自行Google。
在程序包管理器控制台输入下列命令安装依赖
 1、Install-Package Newtonsoft.Json
 2、Install-Package jose-jwt
 Newtonsoft.Json用来进行json转换
 jose-jwt用来进行jwt签名</p></blockquote><h5><a name='header-n2595' class='md-header-anchor '></a>API调用代码</h5><pre class="md-fences md-end-block" lang="c#" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">using</span> <span class="cm-variable">System</span>;</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">using</span> <span class="cm-variable">System</span>.<span class="cm-variable">Collections</span>.<span class="cm-variable">Generic</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">using</span> <span class="cm-variable">System</span>.<span class="cm-variable">IO</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">using</span> <span class="cm-variable">System</span>.<span class="cm-variable">Net</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">using</span> <span class="cm-variable">System</span>.<span class="cm-variable">Security</span>.<span class="cm-variable">Cryptography</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">using</span> <span class="cm-variable">System</span>.<span class="cm-variable">Security</span>.<span class="cm-variable">Cryptography</span>.<span class="cm-variable">X509Certificates</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">using</span> <span class="cm-variable">System</span>.<span class="cm-variable">Text</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">using</span> <span class="cm-variable">System</span>.<span class="cm-variable">Web</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">using</span> <span class="cm-variable">Jose</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">using</span> <span class="cm-variable">Newtonsoft</span>.<span class="cm-variable">Json</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">namespace</span> <span class="cm-def">Invoicing</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">internal</span> <span class="cm-keyword">class</span> <span class="cm-def">Program</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-keyword">void</span> <span class="cm-variable">Main</span>(<span class="cm-variable-3">string</span>[] <span class="cm-variable">args</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//构造url</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">baseUrl</span> <span class="cm-operator">=</span> <span class="cm-string">"https://127.0.0.1:8080"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">url</span> <span class="cm-operator">=</span> <span class="cm-variable">baseUrl</span> <span class="cm-operator">+</span> <span class="cm-string">"/invoiceclient-web/api/invoiceApply/insertWithArray?appid=123213"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">req</span> <span class="cm-operator">=</span> (<span class="cm-variable">HttpWebRequest</span>) <span class="cm-variable">WebRequest</span>.<span class="cm-variable">Create</span>(<span class="cm-variable">url</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//请求体参数_requestdatas(发票头+发票明细)</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">requestdatas</span> <span class="cm-operator">=</span> <span class="cm-variable">BuildRequestDatas</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">paraEnvoice</span> <span class="cm-operator">=</span> <span class="cm-string">"requestdatas="</span> <span class="cm-operator">+</span> <span class="cm-variable">Uri</span>.<span class="cm-variable">EscapeDataString</span>(<span class="cm-variable">requestdatas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//json数组格式，可以多张发票，流水号关联</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//请求体参数_email(邮件推送配置)</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">paraEmail</span> <span class="cm-operator">=</span> <span class="cm-string">"email="</span> <span class="cm-operator">+</span> <span class="cm-variable">Uri</span>.<span class="cm-variable">EscapeDataString</span>(<span class="cm-variable">BuildEmailData</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//请求体参数_sms(短信推送配置)</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">paraSms</span> <span class="cm-operator">=</span> <span class="cm-string">"sms="</span> <span class="cm-operator">+</span> <span class="cm-variable">BuildMobileData</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//json数组格式，可以多手机号，以流水号关联</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//请求体参数_url(回调服务配置)</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">paraUrl</span> <span class="cm-operator">=</span> <span class="cm-string">"url="</span> <span class="cm-operator">+</span> <span class="cm-variable">HttpUtility</span>.<span class="cm-variable">UrlEncode</span>(<span class="cm-variable">BuildUrlData</span>()); <span class="cm-comment">//json数组格式，可以多url，以流水号关联 </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//拼接参数字符串</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">param</span> <span class="cm-operator">=</span> <span class="cm-variable">paraEnvoice</span> <span class="cm-operator">+</span> <span class="cm-string">'&amp;'</span> <span class="cm-operator">+</span> <span class="cm-variable">paraEmail</span> <span class="cm-operator">+</span> <span class="cm-string">'&amp;'</span> <span class="cm-operator">+</span> <span class="cm-variable">paraSms</span> <span class="cm-operator">+</span> <span class="cm-string">'&amp;'</span> <span class="cm-operator">+</span> <span class="cm-variable">paraUrl</span> <span class="cm-operator">+</span> <span class="cm-string">"&amp;autoAudit=false"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//设置消息头</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// var bs = Encoding.ASCII.GetBytes(param);</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">bs</span> <span class="cm-operator">=</span> <span class="cm-variable">Encoding</span>.<span class="cm-variable">UTF8</span>.<span class="cm-variable">GetBytes</span>(<span class="cm-variable">param</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">req</span>.<span class="cm-variable">Method</span> <span class="cm-operator">=</span> <span class="cm-string">"POST"</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">req</span>.<span class="cm-variable">ContentType</span> <span class="cm-operator">=</span> <span class="cm-string">"application/x-www-form-urlencoded;charset="</span> <span class="cm-operator">+</span> <span class="cm-variable">Encoding</span>.<span class="cm-variable">UTF8</span>.<span class="cm-variable">WebName</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">req</span>.<span class="cm-variable">Headers</span>.<span class="cm-variable">Add</span>(<span class="cm-string">"sign"</span>, <span class="cm-variable">Sign</span>(<span class="cm-variable">requestdatas</span>)); <span class="cm-comment">//放入签名信息在消息头</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">req</span>.<span class="cm-variable">ContentLength</span> <span class="cm-operator">=</span> <span class="cm-variable">bs</span>.<span class="cm-variable">Length</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Console</span>.<span class="cm-variable">WriteLine</span>(<span class="cm-string">"请求头信息:"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Console</span>.<span class="cm-variable">WriteLine</span>(<span class="cm-variable">req</span>.<span class="cm-variable">Headers</span>.<span class="cm-variable">ToString</span>());</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Console</span>.<span class="cm-variable">WriteLine</span>(<span class="cm-string">"---------------------------"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Console</span>.<span class="cm-variable">WriteLine</span>(<span class="cm-string">"请求体信息:"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Console</span>.<span class="cm-variable">WriteLine</span>(<span class="cm-variable">param</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Console</span>.<span class="cm-variable">WriteLine</span>(<span class="cm-string">"---------------------------"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//发送请求</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">using</span> (<span class="cm-keyword">var</span> <span class="cm-def">reqStream</span> <span class="cm-operator">=</span> <span class="cm-variable">req</span>.<span class="cm-variable">GetRequestStream</span>())</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">reqStream</span>.<span class="cm-variable">Write</span>(<span class="cm-variable">bs</span>, <span class="cm-number">0</span>, <span class="cm-variable">bs</span>.<span class="cm-variable">Length</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">reqStream</span>.<span class="cm-variable">Close</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//获取请求</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">using</span> (<span class="cm-keyword">var</span> <span class="cm-def">response</span> <span class="cm-operator">=</span> (<span class="cm-variable">HttpWebResponse</span>) <span class="cm-variable">req</span>.<span class="cm-variable">GetResponse</span>())</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">responseStream</span> <span class="cm-operator">=</span> <span class="cm-variable">response</span>.<span class="cm-variable">GetResponseStream</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">responseStream</span> <span class="cm-operator">==</span> <span class="cm-atom">null</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">using</span> (<span class="cm-keyword">var</span> <span class="cm-def">reader</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">StreamReader</span>(<span class="cm-variable">responseStream</span>, <span class="cm-variable">Encoding</span>.<span class="cm-variable">UTF8</span>))</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">responseData</span> <span class="cm-operator">=</span> <span class="cm-variable">reader</span>.<span class="cm-variable">ReadToEnd</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Console</span>.<span class="cm-variable">WriteLine</span>(<span class="cm-string">"返回信息:"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Console</span>.<span class="cm-variable">WriteLine</span>(<span class="cm-variable">responseData</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">Console</span>.<span class="cm-variable">WriteLine</span>(<span class="cm-string">"---------------------------"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;summary&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &nbsp; &nbsp; 数据签名</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;/summary&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;param name="requestdatas"&gt;&lt;/param&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;returns&gt;&lt;/returns&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">string</span> <span class="cm-variable">Sign</span>(<span class="cm-variable-3">string</span> <span class="cm-variable">requestdatas</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">ts</span> <span class="cm-operator">=</span> <span class="cm-variable-3">DateTime</span>.<span class="cm-variable">UtcNow</span> <span class="cm-operator">-</span> <span class="cm-keyword">new</span> <span class="cm-variable-3">DateTime</span>(<span class="cm-number">1970</span>, <span class="cm-number">1</span>, <span class="cm-number">1</span>, <span class="cm-number">0</span>, <span class="cm-number">0</span>, <span class="cm-number">0</span>, <span class="cm-number">0</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//5分钟内有效</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">exp</span> <span class="cm-operator">=</span> <span class="cm-variable">ts</span>.<span class="cm-variable">TotalMilliseconds</span> <span class="cm-operator">+</span> <span class="cm-number">360000</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">payload</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">Dictionary</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">string</span>, <span class="cm-variable-3">object</span><span class="cm-operator">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"sub"</span>, <span class="cm-string">"tester"</span>},</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"exp"</span>, <span class="cm-variable">exp</span>},</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"requestdatas"</span>, <span class="cm-variable">GetMd5</span>(<span class="cm-variable">requestdatas</span>)}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  };</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">privateKey</span> <span class="cm-operator">=</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">new</span> <span class="cm-variable">X509Certificate2</span>(<span class="cm-string">"D:/CA/keystore/pro22.pfx"</span>, <span class="cm-string">"password"</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">X509KeyStorageFlags</span>.<span class="cm-variable">Exportable</span> <span class="cm-operator">|</span> <span class="cm-variable">X509KeyStorageFlags</span>.<span class="cm-variable">MachineKeySet</span>).<span class="cm-variable">PrivateKey</span> <span class="cm-keyword">as</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">RSACryptoServiceProvider</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">token</span> <span class="cm-operator">=</span> <span class="cm-variable">JWT</span>.<span class="cm-variable">Encode</span>(<span class="cm-variable">payload</span>, <span class="cm-variable">privateKey</span>, <span class="cm-variable">JwsAlgorithm</span>.<span class="cm-variable">PS256</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">token</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;summary&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &nbsp; &nbsp; 获取md5值</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;/summary&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;param name="requestdatas"&gt;&lt;/param&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;returns&gt;&lt;/returns&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">string</span> <span class="cm-variable">GetMd5</span>(<span class="cm-variable-3">string</span> <span class="cm-variable">requestdatas</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">using</span> (<span class="cm-keyword">var</span> <span class="cm-def">md5Hash</span> <span class="cm-operator">=</span> <span class="cm-variable">MD5</span>.<span class="cm-variable">Create</span>())</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">hash</span> <span class="cm-operator">=</span> <span class="cm-variable">GetMd5Hash</span>(<span class="cm-variable">md5Hash</span>, <span class="cm-variable">requestdatas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">hash</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">string</span> <span class="cm-variable">GetMd5Hash</span>(<span class="cm-variable">MD5</span> <span class="cm-variable">md5Hash</span>, <span class="cm-variable-3">string</span> <span class="cm-variable">input</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// Convert the input string to a byte array and compute the hash.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">data</span> <span class="cm-operator">=</span> <span class="cm-variable">md5Hash</span>.<span class="cm-variable">ComputeHash</span>(<span class="cm-variable">Encoding</span>.<span class="cm-variable">UTF8</span>.<span class="cm-variable">GetBytes</span>(<span class="cm-variable">input</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// Create a new Stringbuilder to collect the bytes</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// and create a string.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">sBuilder</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">StringBuilder</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// Loop through each byte of the hashed data </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// and format each one as a hexadecimal string.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">for</span> (<span class="cm-keyword">var</span> <span class="cm-def">i</span> <span class="cm-operator">=</span> <span class="cm-number">0</span>; <span class="cm-variable">i</span> <span class="cm-operator">&lt;</span> <span class="cm-variable">data</span>.<span class="cm-variable">Length</span>; <span class="cm-variable">i</span><span class="cm-operator">++</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">sBuilder</span>.<span class="cm-variable">Append</span>(<span class="cm-variable">data</span>[<span class="cm-variable">i</span>].<span class="cm-variable">ToString</span>(<span class="cm-string">"x2"</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// Return the hexadecimal string.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">sBuilder</span>.<span class="cm-variable">ToString</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;summary&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &nbsp; &nbsp; 构造邮件交付配置信息</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;/summary&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;returns&gt;&lt;/returns&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">string</span> <span class="cm-variable">BuildEmailData</span>()</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">emailDatas</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable">Dictionary</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">string</span>, <span class="cm-variable-3">object</span><span class="cm-operator">&gt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">oneEmail</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">Dictionary</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">string</span>, <span class="cm-variable-3">object</span><span class="cm-operator">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"fpqqlsh"</span>, <span class="cm-string">"1234567890"</span>},</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"address"</span>, <span class="cm-string">"xxx@yonyou.com"</span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  };</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">emailDatas</span>.<span class="cm-variable">Add</span>(<span class="cm-variable">oneEmail</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">JsonConvert</span>.<span class="cm-variable">SerializeObject</span>(<span class="cm-variable">emailDatas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;summary&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &nbsp; &nbsp; 构建短信交付配置</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;/summary&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;returns&gt;&lt;/returns&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">string</span> <span class="cm-variable">BuildMobileData</span>()</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">mobileDatas</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable">Dictionary</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">string</span>, <span class="cm-variable-3">object</span><span class="cm-operator">&gt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">oneMobile</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">Dictionary</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">string</span>, <span class="cm-variable-3">object</span><span class="cm-operator">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"fpqqlsh"</span>, <span class="cm-string">"1234567890"</span>},</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"address"</span>, <span class="cm-string">"13111111111"</span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  };</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">mobileDatas</span>.<span class="cm-variable">Add</span>(<span class="cm-variable">oneMobile</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">JsonConvert</span>.<span class="cm-variable">SerializeObject</span>(<span class="cm-variable">mobileDatas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;summary&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &nbsp; &nbsp; 构建url回调配置</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;/summary&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;returns&gt;&lt;/returns&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">string</span> <span class="cm-variable">BuildUrlData</span>()</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">urlDatas</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable">Dictionary</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">string</span>, <span class="cm-variable-3">object</span><span class="cm-operator">&gt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">oneUrl</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">Dictionary</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">string</span>, <span class="cm-variable-3">object</span><span class="cm-operator">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"fpqqlsh"</span>, <span class="cm-string">"1234567890"</span>},</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"url"</span>, <span class="cm-string">"http://127.0.0.1:8080/callback"</span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  };</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">urlDatas</span>.<span class="cm-variable">Add</span>(<span class="cm-variable">oneUrl</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">JsonConvert</span>.<span class="cm-variable">SerializeObject</span>(<span class="cm-variable">urlDatas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;summary&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &nbsp; &nbsp; 开票请求数据</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;/summary&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/// &lt;returns&gt;&lt;/returns&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-variable-3">string</span> <span class="cm-variable">BuildRequestDatas</span>()</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">requestDatas</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable">Dictionary</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">string</span>, <span class="cm-variable-3">object</span><span class="cm-operator">&gt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//构造发票头</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">oneInvoice</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">Dictionary</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">string</span>, <span class="cm-variable-3">object</span><span class="cm-operator">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"FPQQLSH"</span>, <span class="cm-string">"12345678902222"</span>},</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"XSF_NSRSBH"</span>, <span class="cm-string">"5001020100060171"</span>},</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"ORGCODE"</span>, <span class="cm-string">"20160914001"</span>},</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"GMF_MC"</span>, <span class="cm-string">"购买方名称"</span>},</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"JSHJ"</span>, <span class="cm-number">117</span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  };</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">requestDatas</span>.<span class="cm-variable">Add</span>(<span class="cm-variable">oneInvoice</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">items</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">List</span><span class="cm-operator">&lt;</span><span class="cm-variable">Dictionary</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">string</span>, <span class="cm-variable-3">object</span><span class="cm-operator">&gt;&gt;</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">oneInvoice</span>.<span class="cm-variable">Add</span>(<span class="cm-string">"items"</span>, <span class="cm-variable">items</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">//构造一个发票明细</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">var</span> <span class="cm-def">oneItem</span> <span class="cm-operator">=</span> <span class="cm-keyword">new</span> <span class="cm-variable">Dictionary</span><span class="cm-operator">&lt;</span><span class="cm-variable-3">string</span>, <span class="cm-variable-3">object</span><span class="cm-operator">&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"XMMC"</span>, <span class="cm-string">"项目名称"</span>},</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"SPBM"</span>, <span class="cm-string">"1070102039900000000"</span>},</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"XMJSHJ"</span>, <span class="cm-number">117</span>},</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<span class="cm-string">"SL"</span>, <span class="cm-number">0.17</span>}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  };</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">items</span>.<span class="cm-variable">Add</span>(<span class="cm-variable">oneItem</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">JsonConvert</span>.<span class="cm-variable">SerializeObject</span>(<span class="cm-variable">requestDatas</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 5390px;"></div><div class="CodeMirror-gutters" style="display: none; height: 5420px;"></div></div></div></pre><h4><a name='header-n2597' class='md-header-anchor '></a><strong>PHP</strong></h4><h5><a name='header-n2598' class='md-header-anchor '></a>添加引用</h5><p>引入JWT.php</p><pre class="md-fences md-end-block" lang="php+html" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 4px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">&lt;?php</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">namespace</span> <span class="cm-def">Firebase\JWT</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">use</span> <span class="cm-variable">\DomainException</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">use</span> <span class="cm-variable">\InvalidArgumentException</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">use</span> <span class="cm-variable">\UnexpectedValueException</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">use</span> <span class="cm-variable">\DateTime</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* JSON Web Token implementation, based on this spec:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* https://tools.ietf.org/html/rfc7519</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* PHP version 5</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* @category Authentication</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* @package  Authentication_JWT</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* @author &nbsp; Neuman Vong &lt;neuman@twilio.com&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* @author &nbsp; Anant Narayanan &lt;anant@php.net&gt;</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* @license  http://opensource.org/licenses/BSD-3-Clause 3-clause BSD</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">* @link &nbsp; &nbsp; https://github.com/firebase/php-jwt</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">class</span> <span class="cm-def">JWT</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* When checking nbf, iat or expiration times,</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* we want to provide some extra leeway time to</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* account for clock skew.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-variable-2">$leeway</span> <span class="cm-operator">=</span> <span class="cm-number">0</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* Allow the current timestamp to be specified.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* Useful for fixing a value within unit testing.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* Will default to PHP time() value if null.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-variable-2">$timestamp</span> <span class="cm-operator">=</span> <span class="cm-atom">null</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-variable-2">$supported_algs</span> <span class="cm-operator">=</span> <span class="cm-keyword">array</span>(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string">'HS256'</span> <span class="cm-operator">=&gt;</span> <span class="cm-keyword">array</span>(<span class="cm-string">'hash_hmac'</span>, <span class="cm-string">'SHA256'</span>),</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string">'HS512'</span> <span class="cm-operator">=&gt;</span> <span class="cm-keyword">array</span>(<span class="cm-string">'hash_hmac'</span>, <span class="cm-string">'SHA512'</span>),</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string">'HS384'</span> <span class="cm-operator">=&gt;</span> <span class="cm-keyword">array</span>(<span class="cm-string">'hash_hmac'</span>, <span class="cm-string">'SHA384'</span>),</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string">'RS256'</span> <span class="cm-operator">=&gt;</span> <span class="cm-keyword">array</span>(<span class="cm-string">'openssl'</span>, <span class="cm-string">'SHA256'</span>),</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string">'RS384'</span> <span class="cm-operator">=&gt;</span> <span class="cm-keyword">array</span>(<span class="cm-string">'openssl'</span>, <span class="cm-string">'SHA384'</span>),</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string">'RS512'</span> <span class="cm-operator">=&gt;</span> <span class="cm-keyword">array</span>(<span class="cm-string">'openssl'</span>, <span class="cm-string">'SHA512'</span>),</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  );</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* Decodes a JWT string into a PHP object.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string &nbsp; &nbsp; &nbsp;  $jwt &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  The JWT</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string|array  $key &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  The key, or map of keys.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  If the algorithm used is asymmetric, this is the public key</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param array &nbsp; &nbsp; &nbsp; &nbsp; $allowed_algs &nbsp; List of supported verification algorithms</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Supported algorithms are 'HS256', 'HS384', 'HS512' and 'RS256'</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return object The JWT's payload as a PHP object</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws UnexpectedValueException &nbsp; &nbsp; Provided JWT was invalid</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws SignatureInvalidException &nbsp;  Provided JWT was invalid because the signature verification failed</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws BeforeValidException &nbsp; &nbsp; &nbsp; &nbsp; Provided JWT is trying to be used before it's eligible as defined by 'nbf'</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws BeforeValidException &nbsp; &nbsp; &nbsp; &nbsp; Provided JWT is trying to be used before it's been created as defined by 'iat'</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws ExpiredException &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Provided JWT has since expired, as defined by the 'exp' claim</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @uses jsonDecode</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @uses urlsafeB64Decode</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">function</span> <span class="cm-def">decode</span>(<span class="cm-variable-2">$jwt</span>, <span class="cm-variable-2">$key</span>, <span class="cm-keyword">array</span> <span class="cm-variable-2">$allowed_algs</span> <span class="cm-operator">=</span> <span class="cm-keyword">array</span>())</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$timestamp</span> <span class="cm-operator">=</span> <span class="cm-builtin">is_null</span>(<span class="cm-keyword">static</span>::<span class="cm-variable-2">$timestamp</span>) <span class="cm-operator">?</span> <span class="cm-builtin">time</span>() : <span class="cm-keyword">static</span>::<span class="cm-variable-2">$timestamp</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-keyword">empty</span>(<span class="cm-variable-2">$key</span>)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">InvalidArgumentException</span>(<span class="cm-string">'Key may not be empty'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$tks</span> <span class="cm-operator">=</span> <span class="cm-builtin">explode</span>(<span class="cm-string">'.'</span>, <span class="cm-variable-2">$jwt</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-builtin">count</span>(<span class="cm-variable-2">$tks</span>) <span class="cm-operator">!=</span> <span class="cm-number">3</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">UnexpectedValueException</span>(<span class="cm-string">'Wrong number of segments'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">list</span>(<span class="cm-variable-2">$headb64</span>, <span class="cm-variable-2">$bodyb64</span>, <span class="cm-variable-2">$cryptob64</span>) <span class="cm-operator">=</span> <span class="cm-variable-2">$tks</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-atom">null</span> <span class="cm-operator">===</span> (<span class="cm-variable-2">$header</span> <span class="cm-operator">=</span> <span class="cm-keyword">static</span>::<span class="cm-variable">jsonDecode</span>(<span class="cm-keyword">static</span>::<span class="cm-variable">urlsafeB64Decode</span>(<span class="cm-variable-2">$headb64</span>)))) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">UnexpectedValueException</span>(<span class="cm-string">'Invalid header encoding'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-atom">null</span> <span class="cm-operator">===</span> <span class="cm-variable-2">$payload</span> <span class="cm-operator">=</span> <span class="cm-keyword">static</span>::<span class="cm-variable">jsonDecode</span>(<span class="cm-keyword">static</span>::<span class="cm-variable">urlsafeB64Decode</span>(<span class="cm-variable-2">$bodyb64</span>))) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">UnexpectedValueException</span>(<span class="cm-string">'Invalid claims encoding'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-atom">false</span> <span class="cm-operator">===</span> (<span class="cm-variable-2">$sig</span> <span class="cm-operator">=</span> <span class="cm-keyword">static</span>::<span class="cm-variable">urlsafeB64Decode</span>(<span class="cm-variable-2">$cryptob64</span>))) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">UnexpectedValueException</span>(<span class="cm-string">'Invalid signature encoding'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-keyword">empty</span>(<span class="cm-variable-2">$header</span><span class="cm-operator">-&gt;</span><span class="cm-variable">alg</span>)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">UnexpectedValueException</span>(<span class="cm-string">'Empty algorithm'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-keyword">empty</span>(<span class="cm-keyword">static</span>::<span class="cm-variable-2">$supported_algs</span>[<span class="cm-variable-2">$header</span><span class="cm-operator">-&gt;</span><span class="cm-variable">alg</span>])) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">UnexpectedValueException</span>(<span class="cm-string">'Algorithm not supported'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-operator">!</span><span class="cm-builtin">in_array</span>(<span class="cm-variable-2">$header</span><span class="cm-operator">-&gt;</span><span class="cm-variable">alg</span>, <span class="cm-variable-2">$allowed_algs</span>)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">UnexpectedValueException</span>(<span class="cm-string">'Algorithm not allowed'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-builtin">is_array</span>(<span class="cm-variable-2">$key</span>) <span class="cm-operator">||</span> <span class="cm-variable-2">$key</span> <span class="cm-keyword">instanceof</span> <span class="cm-variable">\ArrayAccess</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-keyword">isset</span>(<span class="cm-variable-2">$header</span><span class="cm-operator">-&gt;</span><span class="cm-variable">kid</span>)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-operator">!</span><span class="cm-keyword">isset</span>(<span class="cm-variable-2">$key</span>[<span class="cm-variable-2">$header</span><span class="cm-operator">-&gt;</span><span class="cm-variable">kid</span>])) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">UnexpectedValueException</span>(<span class="cm-string">'"kid" invalid, unable to lookup correct key'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$key</span> <span class="cm-operator">=</span> <span class="cm-variable-2">$key</span>[<span class="cm-variable-2">$header</span><span class="cm-operator">-&gt;</span><span class="cm-variable">kid</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } <span class="cm-keyword">else</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">UnexpectedValueException</span>(<span class="cm-string">'"kid" empty, unable to lookup correct key'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// Check the signature</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-operator">!</span><span class="cm-keyword">static</span>::<span class="cm-variable">verify</span>(<span class="cm-string">"</span><span class="cm-variable-2">$headb64</span><span class="cm-string">.</span><span class="cm-variable-2">$bodyb64</span><span class="cm-string">"</span>, <span class="cm-variable-2">$sig</span>, <span class="cm-variable-2">$key</span>, <span class="cm-variable-2">$header</span><span class="cm-operator">-&gt;</span><span class="cm-variable">alg</span>)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">SignatureInvalidException</span>(<span class="cm-string">'Signature verification failed'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// Check if the nbf if it is defined. This is the time that the</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// token can actually be used. If it's not yet that time, abort.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-keyword">isset</span>(<span class="cm-variable-2">$payload</span><span class="cm-operator">-&gt;</span><span class="cm-variable">nbf</span>) <span class="cm-operator">&amp;&amp;</span> <span class="cm-variable-2">$payload</span><span class="cm-operator">-&gt;</span><span class="cm-variable">nbf</span> <span class="cm-operator">&gt;</span> (<span class="cm-variable-2">$timestamp</span> <span class="cm-operator">+</span> <span class="cm-keyword">static</span>::<span class="cm-variable-2">$leeway</span>)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">BeforeValidException</span>(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string">'Cannot handle token prior to '</span> . <span class="cm-builtin">date</span>(<span class="cm-variable">DateTime</span>::<span class="cm-variable">ISO8601</span>, <span class="cm-variable-2">$payload</span><span class="cm-operator">-&gt;</span><span class="cm-variable">nbf</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  );</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// Check that this token has been created before 'now'. This prevents</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// using tokens that have been created for later use (and haven't</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// correctly used the nbf claim).</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-keyword">isset</span>(<span class="cm-variable-2">$payload</span><span class="cm-operator">-&gt;</span><span class="cm-variable">iat</span>) <span class="cm-operator">&amp;&amp;</span> <span class="cm-variable-2">$payload</span><span class="cm-operator">-&gt;</span><span class="cm-variable">iat</span> <span class="cm-operator">&gt;</span> (<span class="cm-variable-2">$timestamp</span> <span class="cm-operator">+</span> <span class="cm-keyword">static</span>::<span class="cm-variable-2">$leeway</span>)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">BeforeValidException</span>(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string">'Cannot handle token prior to '</span> . <span class="cm-builtin">date</span>(<span class="cm-variable">DateTime</span>::<span class="cm-variable">ISO8601</span>, <span class="cm-variable-2">$payload</span><span class="cm-operator">-&gt;</span><span class="cm-variable">iat</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  );</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// Check if this token has expired.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-keyword">isset</span>(<span class="cm-variable-2">$payload</span><span class="cm-operator">-&gt;</span><span class="cm-variable">exp</span>) <span class="cm-operator">&amp;&amp;</span> (<span class="cm-variable-2">$timestamp</span> <span class="cm-operator">-</span> <span class="cm-keyword">static</span>::<span class="cm-variable-2">$leeway</span>) <span class="cm-operator">&gt;=</span> <span class="cm-variable-2">$payload</span><span class="cm-operator">-&gt;</span><span class="cm-variable">exp</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">ExpiredException</span>(<span class="cm-string">'Expired token'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable-2">$payload</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* Converts and signs a PHP object or array into a JWT string.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param object|array  $payload &nbsp;  PHP object or array</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string &nbsp; &nbsp; &nbsp;  $key &nbsp; &nbsp; &nbsp;  The secret key.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  If the algorithm used is asymmetric, this is the private key</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string &nbsp; &nbsp; &nbsp;  $alg &nbsp; &nbsp; &nbsp;  The signing algorithm.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Supported algorithms are 'HS256', 'HS384', 'HS512' and 'RS256'</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param mixed &nbsp; &nbsp; &nbsp; &nbsp; $keyId</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param array &nbsp; &nbsp; &nbsp; &nbsp; $head &nbsp; &nbsp; &nbsp; An array with header elements to attach</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return string A signed JWT</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @uses jsonEncode</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @uses urlsafeB64Encode</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">function</span> <span class="cm-def">encode</span>(<span class="cm-variable-2">$payload</span>, <span class="cm-variable-2">$key</span>, <span class="cm-variable-2">$alg</span> <span class="cm-operator">=</span> <span class="cm-string">'HS256'</span>, <span class="cm-variable-2">$keyId</span> <span class="cm-operator">=</span> <span class="cm-atom">null</span>, <span class="cm-variable-2">$head</span> <span class="cm-operator">=</span> <span class="cm-atom">null</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$header</span> <span class="cm-operator">=</span> <span class="cm-keyword">array</span>(<span class="cm-string">'typ'</span> <span class="cm-operator">=&gt;</span> <span class="cm-string">'JWT'</span>, <span class="cm-string">'alg'</span> <span class="cm-operator">=&gt;</span> <span class="cm-variable-2">$alg</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable-2">$keyId</span> <span class="cm-operator">!==</span> <span class="cm-atom">null</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$header</span>[<span class="cm-string">'kid'</span>] <span class="cm-operator">=</span> <span class="cm-variable-2">$keyId</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> ( <span class="cm-keyword">isset</span>(<span class="cm-variable-2">$head</span>) <span class="cm-operator">&amp;&amp;</span> <span class="cm-builtin">is_array</span>(<span class="cm-variable-2">$head</span>) ) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$header</span> <span class="cm-operator">=</span> <span class="cm-builtin">array_merge</span>(<span class="cm-variable-2">$head</span>, <span class="cm-variable-2">$header</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$segments</span> <span class="cm-operator">=</span> <span class="cm-keyword">array</span>();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$segments</span>[] <span class="cm-operator">=</span> <span class="cm-keyword">static</span>::<span class="cm-variable">urlsafeB64Encode</span>(<span class="cm-keyword">static</span>::<span class="cm-variable">jsonEncode</span>(<span class="cm-variable-2">$header</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$segments</span>[] <span class="cm-operator">=</span> <span class="cm-keyword">static</span>::<span class="cm-variable">urlsafeB64Encode</span>(<span class="cm-keyword">static</span>::<span class="cm-variable">jsonEncode</span>(<span class="cm-variable-2">$payload</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$signing_input</span> <span class="cm-operator">=</span> <span class="cm-builtin">implode</span>(<span class="cm-string">'.'</span>, <span class="cm-variable-2">$segments</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$signature</span> <span class="cm-operator">=</span> <span class="cm-keyword">static</span>::<span class="cm-variable">sign</span>(<span class="cm-variable-2">$signing_input</span>, <span class="cm-variable-2">$key</span>, <span class="cm-variable-2">$alg</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$segments</span>[] <span class="cm-operator">=</span> <span class="cm-keyword">static</span>::<span class="cm-variable">urlsafeB64Encode</span>(<span class="cm-variable-2">$signature</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-builtin">implode</span>(<span class="cm-string">'.'</span>, <span class="cm-variable-2">$segments</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* Sign a string with a given key and algorithm.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $msg &nbsp;  The message to sign</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string|resource &nbsp; $key &nbsp;  The secret key</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $alg &nbsp;  The signing algorithm.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Supported algorithms are 'HS256', 'HS384', 'HS512' and 'RS256'</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return string An encrypted message</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws DomainException Unsupported algorithm was specified</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">function</span> <span class="cm-def">sign</span>(<span class="cm-variable-2">$msg</span>, <span class="cm-variable-2">$key</span>, <span class="cm-variable-2">$alg</span> <span class="cm-operator">=</span> <span class="cm-string">'HS256'</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-keyword">empty</span>(<span class="cm-keyword">static</span>::<span class="cm-variable-2">$supported_algs</span>[<span class="cm-variable-2">$alg</span>])) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">DomainException</span>(<span class="cm-string">'Algorithm not supported'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">list</span>(<span class="cm-variable-2">$function</span>, <span class="cm-variable-2">$algorithm</span>) <span class="cm-operator">=</span> <span class="cm-keyword">static</span>::<span class="cm-variable-2">$supported_algs</span>[<span class="cm-variable-2">$alg</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">switch</span>(<span class="cm-variable-2">$function</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">case</span> <span class="cm-string">'hash_hmac'</span>:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">hash_hmac</span>(<span class="cm-variable-2">$algorithm</span>, <span class="cm-variable-2">$msg</span>, <span class="cm-variable-2">$key</span>, <span class="cm-atom">true</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">case</span> <span class="cm-string">'openssl'</span>:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$signature</span> <span class="cm-operator">=</span> <span class="cm-string">''</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$success</span> <span class="cm-operator">=</span> <span class="cm-variable">openssl_sign</span>(<span class="cm-variable-2">$msg</span>, <span class="cm-variable-2">$signature</span>, <span class="cm-variable-2">$key</span>, <span class="cm-variable-2">$algorithm</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-operator">!</span><span class="cm-variable-2">$success</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">DomainException</span>(<span class="cm-string">"OpenSSL unable to sign data"</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } <span class="cm-keyword">else</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable-2">$signature</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* Verify a signature with the message, key and method. Not all methods</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* are symmetric, so we must have a separate verify and sign method.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $msg &nbsp; &nbsp; &nbsp;  The original message (header and body)</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $signature  The original signature</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string|resource &nbsp; $key &nbsp; &nbsp; &nbsp;  For HS*, a string key works. for RS*, must be a resource of an openssl public key</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $alg &nbsp; &nbsp; &nbsp;  The algorithm</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return bool</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws DomainException Invalid Algorithm or OpenSSL failure</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-keyword">function</span> <span class="cm-def">verify</span>(<span class="cm-variable-2">$msg</span>, <span class="cm-variable-2">$signature</span>, <span class="cm-variable-2">$key</span>, <span class="cm-variable-2">$alg</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-keyword">empty</span>(<span class="cm-keyword">static</span>::<span class="cm-variable-2">$supported_algs</span>[<span class="cm-variable-2">$alg</span>])) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">DomainException</span>(<span class="cm-string">'Algorithm not supported'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">list</span>(<span class="cm-variable-2">$function</span>, <span class="cm-variable-2">$algorithm</span>) <span class="cm-operator">=</span> <span class="cm-keyword">static</span>::<span class="cm-variable-2">$supported_algs</span>[<span class="cm-variable-2">$alg</span>];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">switch</span>(<span class="cm-variable-2">$function</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">case</span> <span class="cm-string">'openssl'</span>:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$success</span> <span class="cm-operator">=</span> <span class="cm-variable">openssl_verify</span>(<span class="cm-variable-2">$msg</span>, <span class="cm-variable-2">$signature</span>, <span class="cm-variable-2">$key</span>, <span class="cm-variable-2">$algorithm</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable-2">$success</span> <span class="cm-operator">===</span> <span class="cm-number">1</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-atom">true</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } <span class="cm-keyword">elseif</span> (<span class="cm-variable-2">$success</span> <span class="cm-operator">===</span> <span class="cm-number">0</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-atom">false</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">// returns 1 on success, 0 on failure, -1 on error.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">DomainException</span>(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-string">'OpenSSL error: '</span> . <span class="cm-variable">openssl_error_string</span>()</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  );</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">case</span> <span class="cm-string">'hash_hmac'</span>:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">default</span>:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$hash</span> <span class="cm-operator">=</span> <span class="cm-variable">hash_hmac</span>(<span class="cm-variable-2">$algorithm</span>, <span class="cm-variable-2">$msg</span>, <span class="cm-variable-2">$key</span>, <span class="cm-atom">true</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">function_exists</span>(<span class="cm-string">'hash_equals'</span>)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">hash_equals</span>(<span class="cm-variable-2">$signature</span>, <span class="cm-variable-2">$hash</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$len</span> <span class="cm-operator">=</span> <span class="cm-builtin">min</span>(<span class="cm-keyword">static</span>::<span class="cm-variable">safeStrlen</span>(<span class="cm-variable-2">$signature</span>), <span class="cm-keyword">static</span>::<span class="cm-variable">safeStrlen</span>(<span class="cm-variable-2">$hash</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$status</span> <span class="cm-operator">=</span> <span class="cm-number">0</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">for</span> (<span class="cm-variable-2">$i</span> <span class="cm-operator">=</span> <span class="cm-number">0</span>; <span class="cm-variable-2">$i</span> <span class="cm-operator">&lt;</span> <span class="cm-variable-2">$len</span>; <span class="cm-variable-2">$i</span><span class="cm-operator">++</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$status</span> <span class="cm-operator">|=</span> (<span class="cm-variable">ord</span>(<span class="cm-variable-2">$signature</span>[<span class="cm-variable-2">$i</span>]) <span class="cm-variable">^</span> <span class="cm-variable">ord</span>(<span class="cm-variable-2">$hash</span>[<span class="cm-variable-2">$i</span>]));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$status</span> <span class="cm-operator">|=</span> (<span class="cm-keyword">static</span>::<span class="cm-variable">safeStrlen</span>(<span class="cm-variable-2">$signature</span>) <span class="cm-variable">^</span> <span class="cm-keyword">static</span>::<span class="cm-variable">safeStrlen</span>(<span class="cm-variable-2">$hash</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> (<span class="cm-variable-2">$status</span> <span class="cm-operator">===</span> <span class="cm-number">0</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* Decode a JSON string into a PHP object.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string $input JSON string</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return object Object representation of JSON string</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws DomainException Provided string was invalid JSON</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">function</span> <span class="cm-def">jsonDecode</span>(<span class="cm-variable-2">$input</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-builtin">version_compare</span>(<span class="cm-variable">PHP_VERSION</span>, <span class="cm-string">'5.4.0'</span>, <span class="cm-string">'&gt;='</span>) <span class="cm-operator">&amp;&amp;</span> <span class="cm-operator">!</span>(<span class="cm-builtin">defined</span>(<span class="cm-string">'JSON_C_VERSION'</span>) <span class="cm-operator">&amp;&amp;</span> <span class="cm-variable">PHP_INT_SIZE</span> <span class="cm-operator">&gt;</span> <span class="cm-number">4</span>)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/** In PHP &gt;=5.4.0, json_decode() accepts an options parameter, that allows you</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">* to specify that large ints (like Steam Transaction IDs) should be treated as</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">* strings, rather than the PHP default behaviour of converting them to floats.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$obj</span> <span class="cm-operator">=</span> <span class="cm-builtin">json_decode</span>(<span class="cm-variable-2">$input</span>, <span class="cm-atom">false</span>, <span class="cm-number">512</span>, <span class="cm-variable">JSON_BIGINT_AS_STRING</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  } <span class="cm-keyword">else</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">/** Not all servers will support that, however, so for older versions we must</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">* manually detect large ints in the JSON string and quote them (thus converting</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">*them to strings) before decoding, hence the preg_replace() call.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$max_int_length</span> <span class="cm-operator">=</span> <span class="cm-builtin">strlen</span>((<span class="cm-variable">string</span>) <span class="cm-variable">PHP_INT_MAX</span>) <span class="cm-operator">-</span> <span class="cm-number">1</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$json_without_bigints</span> <span class="cm-operator">=</span> <span class="cm-builtin">preg_replace</span>(<span class="cm-string">'/:\s*(-?\d{'</span>.<span class="cm-variable-2">$max_int_length</span>.<span class="cm-string">',})/'</span>, <span class="cm-string">': "$1"'</span>, <span class="cm-variable-2">$input</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$obj</span> <span class="cm-operator">=</span> <span class="cm-builtin">json_decode</span>(<span class="cm-variable-2">$json_without_bigints</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">function_exists</span>(<span class="cm-string">'json_last_error'</span>) <span class="cm-operator">&amp;&amp;</span> <span class="cm-variable-2">$errno</span> <span class="cm-operator">=</span> <span class="cm-builtin">json_last_error</span>()) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">static</span>::<span class="cm-variable">handleJsonError</span>(<span class="cm-variable-2">$errno</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  } <span class="cm-keyword">elseif</span> (<span class="cm-variable-2">$obj</span> <span class="cm-operator">===</span> <span class="cm-atom">null</span> <span class="cm-operator">&amp;&amp;</span> <span class="cm-variable-2">$input</span> <span class="cm-operator">!==</span> <span class="cm-string">'null'</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">DomainException</span>(<span class="cm-string">'Null result with non-null input'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable-2">$obj</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* Encode a PHP object into a JSON string.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param object|array $input A PHP object or array</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return string JSON representation of the PHP object or array</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @throws DomainException Provided object could not be encoded to valid JSON</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">function</span> <span class="cm-def">jsonEncode</span>(<span class="cm-variable-2">$input</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$json</span> <span class="cm-operator">=</span> <span class="cm-builtin">json_encode</span>(<span class="cm-variable-2">$input</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">function_exists</span>(<span class="cm-string">'json_last_error'</span>) <span class="cm-operator">&amp;&amp;</span> <span class="cm-variable-2">$errno</span> <span class="cm-operator">=</span> <span class="cm-builtin">json_last_error</span>()) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">static</span>::<span class="cm-variable">handleJsonError</span>(<span class="cm-variable-2">$errno</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  } <span class="cm-keyword">elseif</span> (<span class="cm-variable-2">$json</span> <span class="cm-operator">===</span> <span class="cm-string">'null'</span> <span class="cm-operator">&amp;&amp;</span> <span class="cm-variable-2">$input</span> <span class="cm-operator">!==</span> <span class="cm-atom">null</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">DomainException</span>(<span class="cm-string">'Null result with non-null input'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable-2">$json</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* Decode a string with URL-safe Base64.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string $input A Base64 encoded string</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return string A decoded string</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">function</span> <span class="cm-def">urlsafeB64Decode</span>(<span class="cm-variable-2">$input</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$remainder</span> <span class="cm-operator">=</span> <span class="cm-builtin">strlen</span>(<span class="cm-variable-2">$input</span>) <span class="cm-operator">%</span> <span class="cm-number">4</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable-2">$remainder</span>) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$padlen</span> <span class="cm-operator">=</span> <span class="cm-number">4</span> <span class="cm-operator">-</span> <span class="cm-variable-2">$remainder</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$input</span> .<span class="cm-operator">=</span> <span class="cm-builtin">str_repeat</span>(<span class="cm-string">'='</span>, <span class="cm-variable-2">$padlen</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-builtin">base64_decode</span>(<span class="cm-builtin">strtr</span>(<span class="cm-variable-2">$input</span>, <span class="cm-string">'-_'</span>, <span class="cm-string">'+/'</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* Encode a string with URL-safe Base64.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string $input The string you want encoded</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return string The base64 encode of what you passed in</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">public</span> <span class="cm-keyword">static</span> <span class="cm-keyword">function</span> <span class="cm-def">urlsafeB64Encode</span>(<span class="cm-variable-2">$input</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-builtin">str_replace</span>(<span class="cm-string">'='</span>, <span class="cm-string">''</span>, <span class="cm-builtin">strtr</span>(<span class="cm-builtin">base64_encode</span>(<span class="cm-variable-2">$input</span>), <span class="cm-string">'+/'</span>, <span class="cm-string">'-_'</span>));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* Helper method to create a JSON error.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param int $errno An error number from json_last_error()</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return void</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-keyword">function</span> <span class="cm-def">handleJsonError</span>(<span class="cm-variable-2">$errno</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable-2">$messages</span> <span class="cm-operator">=</span> <span class="cm-keyword">array</span>(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">JSON_ERROR_DEPTH</span> <span class="cm-operator">=&gt;</span> <span class="cm-string">'Maximum stack depth exceeded'</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">JSON_ERROR_STATE_MISMATCH</span> <span class="cm-operator">=&gt;</span> <span class="cm-string">'Invalid or malformed JSON'</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">JSON_ERROR_CTRL_CHAR</span> <span class="cm-operator">=&gt;</span> <span class="cm-string">'Unexpected control character found'</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">JSON_ERROR_SYNTAX</span> <span class="cm-operator">=&gt;</span> <span class="cm-string">'Syntax error, malformed JSON'</span>,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-variable">JSON_ERROR_UTF8</span> <span class="cm-operator">=&gt;</span> <span class="cm-string">'Malformed UTF-8 characters'</span> <span class="cm-comment">//PHP &gt;= 5.3.3</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  );</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">throw</span> <span class="cm-keyword">new</span> <span class="cm-variable">DomainException</span>(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">isset</span>(<span class="cm-variable-2">$messages</span>[<span class="cm-variable-2">$errno</span>])</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-operator">?</span> <span class="cm-variable-2">$messages</span>[<span class="cm-variable-2">$errno</span>]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  : <span class="cm-string">'Unknown JSON error: '</span> . <span class="cm-variable-2">$errno</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  );</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">/**</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* Get the number of bytes in cryptographic strings.</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @param string</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">* @return int</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; <span class="cm-comment">*/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-keyword">private</span> <span class="cm-keyword">static</span> <span class="cm-keyword">function</span> <span class="cm-def">safeStrlen</span>(<span class="cm-variable-2">$str</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">if</span> (<span class="cm-variable">function_exists</span>(<span class="cm-string">'mb_strlen'</span>)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-variable">mb_strlen</span>(<span class="cm-variable-2">$str</span>, <span class="cm-string">'8bit'</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-keyword">return</span> <span class="cm-builtin">strlen</span>(<span class="cm-variable-2">$str</span>);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 9185px;"></div><div class="CodeMirror-gutters" style="display: none; height: 9215px;"></div></div></div></pre><h5><a name='header-n2602' class='md-header-anchor '></a>API调用代码</h5><pre class="md-fences md-end-block md-focus" lang="php" style="break-inside: unset;"> <div class="CodeMirror cm-s-inner CodeMirror-wrap CodeMirror-focused"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 3983px; left: 8px;"></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><span><span>​</span>x</span></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="" style="position: relative;"><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&lt;?php</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">require 'vendor/autoload.php';</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">use \Firebase\JWT\JWT;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">include('JWT.php');</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">class InvoiceDemo {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  private static $appid = 'commontesterCA';</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  private static $baseUrl = 'https://yesfp.yonyoucloud.com/invoiceclient-web/api/invoiceApply/';</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  private static $keyfile='D:/web/irm-cams.web/cn/pro22.pfx';</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  private static $blueApi = 'insertWithArray';</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  //开蓝票接口</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; public function blueInvoice() {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $fpqqlsh = $this-&gt;buildFpqqlsh();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $requestdatas = array(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  array(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "FPQQLSH" =&gt; $fpqqlsh,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "XSF_NSRSBH" =&gt; "201609140000001",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "ORGCODE" =&gt; "20160914001",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "GMF_MC" =&gt; "天津国联鸿泰科技有限公司",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "GMF_DZDH" =&gt; "天津市河北区王串场街王串场四号路4号增19号 86-022-84847456",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "GMF_YHZH" =&gt; "中国建设银行股份有限公司天津河北支行 12050166080000000517",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "ZDYBZ" =&gt; "这是放射所报名费xx单号的开票",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "JSHJ" =&gt; 780.00,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "items" =&gt; array(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  array(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "XMMC" =&gt; "技术服务费",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "SPBM" =&gt; "3040101",</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "XMJSHJ" =&gt; 117,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "SL" =&gt; 0.06,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  );</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $url = array(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  array(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "fpqqlsh"=&gt;$fpqqlsh,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "url" =&gt; "http://bjxr246.cname.zaojiaojia.net/callback.php?callbackUrl"</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  );</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $email=array(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "fpqqlsh"=&gt;$fpqqlsh,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "address"=&gt;"315389520@qq.com"</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  );</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $params = array(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'requestdatas'=&gt;json_encode($requestdatas),</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'email'=&gt;json_encode($email), &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'url'=&gt;json_encode($url),</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  "autoAudit" =&gt; 'true'</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  );</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; return  $this-&gt;exec(self::$blueApi, $params);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;  //获取发票请求流水号(唯一)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  private function &nbsp;  buildFpqqlsh(){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp;  return "2018052615510000004";</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  protected function exec($api, array $params) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $api = self::$baseUrl . $api . "?appid=" . self::$appid;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $options = array(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'header'=&gt;array(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'sign'=&gt;$this-&gt;sign($params),</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  )</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  );</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  return self::post($api, $params, $options);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  //jwt签名</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  private function sign(array $params){</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $ts = time();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $signParams = array(</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'sub'=&gt;'tester',</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'iss'=&gt;'einvoice',</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'aud'=&gt;'einvoice',</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'jti'=&gt;$ts,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'iat'=&gt;$ts,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'exp'=&gt;$ts+300,</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  'nbf'=&gt;$ts-300</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  );</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  // 需要将表单参数requestdatas的数据进行md5加密，然后放到签名数据的requestdatas中。</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  // 此签名数据必须存在，否则在验证签名时会不通过。</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $requestdatas=$params['requestdatas'];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  if(!empty($requestdatas)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $signParams['requestdatas'] = md5($requestdatas);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  //读取CA证书与PEM格式证书需要根据实际证书使用情况而定,目前这两种都支持 </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $privateKey = $this-&gt;loadPrivateKeyOfCA(self::$keyfile);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  // $privateKey = $this-&gt;loadPrivateKeyOfPem(self::$keyfile); &nbsp; &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $sign = JWT::encode($signParams, $privateKey, 'RS256');</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  return $sign;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  //读取PEM编码格式</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  private function loadPrivateKeyOfPem($file) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  if(!file_exists($file)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  throw new \Exception("Error: Key file $file is not exists.");</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  if(!$key = file_get_contents($file)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  throw new \Exception("Error: Key file $file is empty.");</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  return $key;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  //读取证书私钥</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; private function loadPrivateKeyOfCA($file) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  if(!file_exists($file)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  throw new \Exception("Error: Cert file $file is not exists.");</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  if (!$cert_store = file_get_contents($file)) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  throw new \Exception("Error: Unable to read the cert file $file .");</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  if (openssl_pkcs12_read($cert_store, $cert_info, "password")) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return $cert_info['pkey'];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  } else {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  throw new \Exception("Error: Unable to read the cert store from $file .");</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  private static function post($url, $params, array $options=null) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $ch = curl_init();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  self::setOption($ch, $options);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  curl_setopt($ch, CURLOPT_URL,$url);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  curl_setopt($ch, CURLOPT_POST, count($params));</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $params = http_build_query($params);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  curl_setopt($ch, CURLOPT_POSTFIELDS, $params);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $content = curl_exec($ch);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $errorCode = curl_errno($ch);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  curl_close($ch);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  return array($errorCode, $content);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  private static function setOption($ch, array $options=null) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  if($options === null) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $options = array();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  if(isset($options["cookie"]) &amp;&amp; is_array($options["cookie"])) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $cookieArr = array();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  foreach($options["cookie"] as $key=&gt;$value) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $cookieArr[] = "$key=$value";</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $cookie = implode("; ", $cookieArr);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  curl_setopt($ch, CURLOPT_COOKIE, $cookie);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  $timeout = 30;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  if(isset($options["timeout"])) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $timeout = $options["timeout"];</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  if(isset($options["ua"])) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  curl_setopt($ch, CURLOPT_USERAGENT, $options["ua"]);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  if(isset($options['header'])) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  curl_setopt($ch, CURLOPT_HEADER, true);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $header = array();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  foreach($options['header'] as $k=&gt;$v) {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $header[] = $k.": ".$v;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  curl_setopt($ch, CURLOPT_HTTPHEADER, $header);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">$invoiceDemo=new InvoiceDemo();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">$result=$invoiceDemo-&gt;blueInvoice();</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">var_dump($result);</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">?&gt;</span></pre><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; border-bottom: 0px solid transparent; top: 4010px;"></div><div class="CodeMirror-gutters" style="display: none; height: 4040px;"></div></div></div></pre></div>
</body>
</html>